Purging socket send buffers - Networking

This is a discussion on Purging socket send buffers - Networking ; Hi, assume you are trying to send data to a remote host over a TCP- socket. Suddenly the remote host blocks for some unspecified time, and your socket send buffer fills up until a write call would block. Is there ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Purging socket send buffers

  1. Purging socket send buffers

    Hi,

    assume you are trying to send data to a remote host over a TCP-
    socket. Suddenly the remote host blocks for some unspecified time,
    and your socket send buffer fills up until a write call would block.
    Is there a way to get rid of the buffered data once it is in the
    socket send buffer managed by the kernel?

    In my specific case messages become stale very quickly, and it may
    have drastic consequences if they get delivered at all if too late.
    If the system detects that a remote host is too slow or screwed up, it
    should do its best to get rid of any message still under its control.
    It would be great if there is a system call that I can use to purge
    data buffered in socket send buffers.

    Regards,
    Markus


  2. Re: Purging socket send buffers

    Markus wrote:
    > Hi,
    >
    > assume you are trying to send data to a remote host over a TCP-
    > socket. Suddenly the remote host blocks for some unspecified time,
    > and your socket send buffer fills up until a write call would block.
    > Is there a way to get rid of the buffered data once it is in the
    > socket send buffer managed by the kernel?
    >
    > In my specific case messages become stale very quickly, and it may
    > have drastic consequences if they get delivered at all if too late.
    > If the system detects that a remote host is too slow or screwed up, it
    > should do its best to get rid of any message still under its control.
    > It would be great if there is a system call that I can use to purge
    > data buffered in socket send buffers.
    >
    > Regards,
    > Markus
    >


    If you were to do that, then the remote host would never recover because
    TCP is a stream, not a sequence of messages. So shutdown() is probably
    what you are after.

    Robert

+ Reply to Thread