Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi everyone,

 

Following is the callback method that I use in my socket programming at client side for async receiving of data from server:-

 

Public Sub OnDataRecieved(ByVal async As IAsyncResult)
       Dim Recieved_Size As Integer = m_clientSocket.EndReceive(async)
       ...........(rest of the code)
End Sub

 

What my doubt is that when "Recieved_Size" = 0, should I conclude that the socket has got disconnected? If not, then under what cases should Recieved_Size be = 0 ?

 

Why I am asking is that whenever the connected server gets disconnected then "OnDataRecieved" method gets called and the resulting "Recieved_Size" is = 0. But it should be called only when there is some data to be read for the socket, not when connect/disconnect happens, right?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...