mySocket.GetStream.EndRead = 0! Why!

Drstein99

Junior Contributor
Joined
Sep 26, 2003
Messages
283
Location
Audubon, Nj
Regarding sockets;

Sometimes my .endread command will return 0 bytes. Its being executed in a async callback function from:

.beginread(readBuffer, 0, READ_BUFFER_SIZE, AddressOf Me.StreamReceiver, strMessage)

------------------

Why does the command execute, and when I conduct my .endread function returns 0 bytes?

Is it issueing a time-out, or keep-alive die? How can I figure out the NATURE of WHY that function was called (as a result of the .beginread) - because when it tells me 0 btyes are available to read from the stream; i'm under the impression its trying to send a message other then "data available" - as a matter of fact i am sure of it, because the remote / socket application on the client test pc shows that it hasnt sent any information or data.

----------------------------
DrStein99
 
Direct quote from the vs.net help file:

"If the remote host shuts down the Socket connection and all available data has been received, the EndRead method will complete immediately and return zero bytes."

--------------------------------

The client and server seem to work well, until I put my app in the background and run another application. Then it will trigger "0" bytes recieved, and obviously shut down the SOCKET. I dont want my sockets to get disconnected (and I write code naturally to re/connect the sockets).

Can anyone reccomend a method of me debugging to keep sockets open, steady and reliable?
---------------
DrStein99
 
My code is lengthy, and has been worked on for about 2 months now. I fear it may cause more confusion, but its necessary for someone to help me. For example, I have procedures that start timers, and time-out if a connection isnt acquired in a certain time. another timer that will destroy the object if it doesnt get a response back from server (after initial login)..... this is a tough one.
 
Back
Top