soj <(E-Mail Removed)> wrote:
> The question is, I'd like to know if we can flush out the receive
> buffer without reading into application?. I don't want to read the
> "old" data present in the receive buffer ? Is there any way to do
> this?
You could close() the socket and open a new one.
If this is a socket bound to a UDP endpoint, you will have a window
where the remote sender could be triggering ICMP Destination
Unreachable, Port Unreachable (IIRC) messages which may or may not be
sent back to the remote application.
With UDP, unless you can guarantee you will be keeping-up with the
stream, you probably want to implement some sort of application-level
flow control between your end and the remote...
If this is a socket bound to a TCP endpoint (probably not since you
mention overflow, but trying to be complete...), you will have a
window where the remote sender will probably trigger RST segments. Of
course, if this is a TCP endpoint, the TCP flow control likely means
that the remote sender got flow-controlled and there may not be all
that much "new" data in the first place. The remote has to know to
reconnect...
Otherwise, I'm pretty sure that the only (portable at least) thing to
do is just read the data from the socket and not do anything with it.
Now, that new-fangled (perhaps egg-laying-wolly-milk-pig

SCTP has,
IIRC a way to specify the timliness of data to SCTP and have it drop
it all on its own... no idea if all the systems involved in what you
want to do include support for SCTP.
rick jones
--
Process shall set you free from the need for rational thought.
these opinions are mine, all mine; HP might not want them anyway...

feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...