Hi everyone,
Following is the callback method that I use in my socket programming at client side for async receiving of data from server:-
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?
Following is the callback method that I use in my socket programming at client side for async receiving of data from server:-
Code:
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?