Socket call back that received packet data gets 0 byte packets

Z

Zytan

During a TCP connection, using standard Sockets, when the other end
decides to cancel the connect, before the socket is disconnected, the
call back to receive the incoming data gets called 100's and 1000's of
times with 0 bytes. And finally the socket disconnects.

I am not sure what this means. Why is it called at all, just to give
me 0 bytes? Of course, I can just ignore these 'no data' packets,
but, I'd like to know why they exist.

any help is appreciated.

Zytan
 
Z

Zytan

.....the call back to receive the incoming data......

This is what is passed to Socket.BeginReceive(), to be called when any
data arrives.

Zytan
 
Z

Zytan

I am not sure what this means. Why is it called at all, just to give
me 0 bytes?

Ah, this thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1477132&SiteID=1
says:

"On the receiving end while a application is in call to
NetworkStream.Read or Socket.Receive method or their equivalent
Asynchronous methods, whenever the sending socket is disconnected you
get 0 bytes from Read or Receive methods."

So, I'm sitting here asking for something, waiting for something, and
when it gives me 0 bytes, it must be telling me, "you're not connected
anymore". And stupid me is asking for more data, to which it replies
the same thing.

Zytan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top