Gary Wright
3/22/2007 5:19:00 AM
On Mar 22, 2007, at 12:29 AM, sairam MP wrote:
> How to Distinguish between reset packet and a normal packet?? Here
> I am
> using TCPSocket API where in Iam Using recvfrom().
You can't. If you are using a TCP socket you don't know where
any packet boundaries are located. TCP only presents a byte
stream to the application.
It sounds like you are describing a situation where data has been
arriving and you are reading it and then for some reason the remote
system decides to abort the TCP connection by sending a TCP RST
packet.
On your end, you'll be able to read all the queued data normally
and then, when you've consumed all the pending data, the next time
you try to read from the socket, an exception will be raised to let
you know that the underlying TCP session has gone away (rather than
being closed cleanly).
Gary Wright