netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Hozza <thozza@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: SOCK_STREAM TCP: send() returns success even when other side responded with RST packet
Date: Tue, 19 Feb 2013 10:46:40 -0500 (EST)	[thread overview]
Message-ID: <671340739.1911519.1361288800967.JavaMail.root@redhat.com> (raw)
In-Reply-To: <1361287646.19353.131.camel@edumazet-glaptop>



----- Original Message -----
> 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

I don't think you understood what I was asking for and this is not the right
place to discuss how to do things. I have read Unix Network Programming from
Richard Stevens but did not find answer for this either. Thanks anyway.

      reply	other threads:[~2013-02-19 15:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <79866921.1777178.1361257053436.JavaMail.root@redhat.com>
2013-02-19  7:02 ` SOCK_STREAM TCP: send() returns success even when other side responded with RST packet Tomas Hozza
2013-02-19 14:51   ` Eric Dumazet
2013-02-19 15:09     ` Tomas Hozza
2013-02-19 15:26       ` Stephen Hemminger
2013-02-19 15:27       ` Eric Dumazet
2013-02-19 15:46         ` Tomas Hozza [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=671340739.1911519.1361288800967.JavaMail.root@redhat.com \
    --to=thozza@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).