[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1361287646.19353.131.camel@edumazet-glaptop>
Date: Tue, 19 Feb 2013 07:27:26 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Tomas Hozza <thozza@...hat.com>
Cc: netdev@...r.kernel.org
Subject: Re: SOCK_STREAM TCP: send() returns success even when other side
responded with RST packet
On Tue, 2013-02-19 at 10:09 -0500, Tomas Hozza wrote:
> I'm using TCP because it should guarantee that my data were delivered or
> let me know there was some problem. If this is not a bug, then it is at least
> confusing for TCP.
Note that a write() on a regular file descriptor has same semantic :
By default, there is no guarantee data is written on stable storage.
>
> > To make sure data is delivered, you need additional logic.
>
> To be honest I didn't find any way how to get notified there was a RST packet
> sent as a reply to my previously sent data.
Well, I suggest you read the man pages and some books, as this is well
explained, you are not the first guy wanting to exchange data using TCP.
man 7 socket
SO_LINGER
Sets or gets the SO_LINGER option. The argument is a linger structure.
struct linger {
int l_onoff; /* linger active */
int l_linger; /* how many seconds to linger for */
};
When enabled, a close(2) or shutdown(2) will not return until all queued messages
for the socket have been successfully sent or the linger timeout has been
reached. Otherwise, the call returns immediately and the closing is done in the
background. When the socket is closed as part of exit(2), it always lingers in
the background.
man 2 shutdown
...
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists