From: sairam MP Date: 2007-03-22T17:52:36+09:00 Subject: Re: How to Distinguish between a Reset packet and a Normal o Gary Wright wrote: > 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 I think its possible,while receiving some data,if the length of data received is zero in a blocked receive function then the connection is said to be reset by peer. Sairam -- Posted via http://www.ruby-forum.com/.