Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
QuestionCheck digit calculation Pin
D i x y31-Mar-08 19:59
D i x y31-Mar-08 19:59 
GeneralRe: Check digit calculation Pin
Eduard Keilholz31-Mar-08 21:09
Eduard Keilholz31-Mar-08 21:09 
QuestionProblem while uploading file on FTP server Pin
pavya_Cool31-Mar-08 19:50
pavya_Cool31-Mar-08 19:50 
AnswerRe: Problem while uploading file on FTP server Pin
JABIR E14-May-08 20:21
JABIR E14-May-08 20:21 
GeneralPass Arguments to Button Click event Pin
karthik_dotnet131-Mar-08 19:18
karthik_dotnet131-Mar-08 19:18 
Questionhow to import GIF file into datagrid Pin
palanirajan31-Mar-08 18:15
palanirajan31-Mar-08 18:15 
QuestionBuilding a pc remote control? Pin
Goalie3531-Mar-08 17:18
Goalie3531-Mar-08 17:18 
GeneralI'm confused about Sockets again... Pin
Jordanwb31-Mar-08 15:50
Jordanwb31-Mar-08 15:50 
... and I'm not afraid to admit. I thought I understood how they work but I guess I was wrong. So can you tell me if my understanding is correct.

Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);<br />
s.Bind(new IPEndPoint(IPAddress.Parse("192.168.1.3"), 37));<br />


I don't have a problem with that, I understand protocols.

s.Listen(6); This means that the socket lets 6 clients connect to this socket to establish a connection. This socket isn't actually used to send/receive data (except under the surface).

This is the OnAccept Callback:
<br />
public void Accept(IAsyncResult ar)<br />
        {<br />
            Socket new_socket = s.EndAccept(ar);<br />
<br />
            s.BeginAccept(new AsyncCallback(Accept), s);<br />
        }<br />


s.EndAccept (ar) returns a new socket which you would use as a connection between host and client. new_socket and s are two seperate sockets. s.BeginAccept(new AsyncCallback(Accept), s) then tells the socket to begin accepting a new client. Now when I want to disconnect the host would do:

new_socket.BeginDisconnect(false, new AsyncCallback(OnDisconnect), s);

But I don't know what to do in the callback. I know there is Shutdown and Disconnect but I don't know where and on which end to do this.

Any helps would be greatly appreciated.
QuestionVisually comparing filestreams/strings Pin
testdi31-Mar-08 13:00
testdi31-Mar-08 13:00 
GeneralIEdge cant be an IEdge Pin
Gareth H31-Mar-08 10:30
Gareth H31-Mar-08 10:30 
GeneralRe: IEdge cant be an IEdge Pin
led mike31-Mar-08 10:44
led mike31-Mar-08 10:44 
QuestionButton Click event with "RenderControl" Pin
wagswvu31-Mar-08 10:13
wagswvu31-Mar-08 10:13 
GeneralRe: Button Click event with "RenderControl" Pin
Jesse Squire31-Mar-08 11:22
Jesse Squire31-Mar-08 11:22 
GeneralRe: Button Click event with "RenderControl" Pin
wagswvu31-Mar-08 11:46
wagswvu31-Mar-08 11:46 
GeneralRe: Button Click event with "RenderControl" Pin
Jesse Squire31-Mar-08 12:44
Jesse Squire31-Mar-08 12:44 
GeneralPopulation dropdown menu on keyboard navigation Pin
AndrusM31-Mar-08 7:10
AndrusM31-Mar-08 7:10 
GeneralRe: Population dropdown menu on keyboard navigation Pin
Alan N31-Mar-08 8:36
Alan N31-Mar-08 8:36 
GeneralRe: Population dropdown menu on keyboard navigation Pin
AndrusM31-Mar-08 9:08
AndrusM31-Mar-08 9:08 
GeneralRe: Population dropdown menu on keyboard navigation Pin
Alan N1-Apr-08 2:42
Alan N1-Apr-08 2:42 
Generalmanaging e-mail attachments question Pin
kknepple31-Mar-08 6:16
kknepple31-Mar-08 6:16 
GeneralRe: managing e-mail attachments question Pin
led mike31-Mar-08 7:24
led mike31-Mar-08 7:24 
GeneralCan anyone expound on this response. Pin
kknepple31-Mar-08 7:40
kknepple31-Mar-08 7:40 
GeneralRe: Can anyone expound on this response. Pin
led mike31-Mar-08 7:48
led mike31-Mar-08 7:48 
GeneralRe: Can anyone expound on this response. Pin
kknepple31-Mar-08 9:07
kknepple31-Mar-08 9:07 
GeneralRe: Can anyone expound on this response. Pin
led mike31-Mar-08 9:14
led mike31-Mar-08 9:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.