S
sairam MP
How to Distinguish between reset packet and a normal packet?? Here I am
using TCPSocket API where in Iam Using recvfrom().
using TCPSocket API where in Iam Using recvfrom().
How to Distinguish between reset packet and a normal packet?? Here
I am
using TCPSocket API where in Iam Using recvfrom().
Gary said: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.
writes 100 bytes that the receiver will read 100 bytes. That is,
that the writes of the sender and the reads of the receiver are
always 'paired up'. This is not the way TCP works. Message
boundaries are not preserved across a TCP stream nor does
each call to 'write' correspond to a single packet on the wire.
TCP can coalesce multiple writes into a single packet and can
also split a single write into multiple packets.
Gary Wright
I found that whenever a Reset Packet while data transfer an
Exception is
raised (Error::ECONNRESET), I think this can be useful.
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.