From: Stephen Hemminger <shemminger@vyatta.com>
To: Rick Jones <rick.jones2@hp.com>
Cc: Paul Martin <srucnoc@gmail.com>, netdev@vger.kernel.org
Subject: Re: TCP partial write
Date: Mon, 15 Jun 2009 10:26:55 -0700 [thread overview]
Message-ID: <20090615102655.5059302d@nehalam> (raw)
In-Reply-To: <4A368049.7080903@hp.com>
On Mon, 15 Jun 2009 10:09:29 -0700
Rick Jones <rick.jones2@hp.com> wrote:
> Paul Martin wrote:
> > Is it possible that a (non-blocking) TCP write(2) will write a number
> > of bytes not multiple of the machine word size? i.e., could a write
> > request for 4 bytes return 2?
>
> Yes.
>
> > Also is this an OS-dependent behavior or there is a spec for it? (I
> > could find atomic guarantees for pipes and datagram sockets but not
> > for TCP)
>
> TCP is a byte-stream. It sends and receives a stream of bytes. You should/must
> assume that when you do a non-blocking write, it will take any number of the
> bytes you offer from 0 to however many bytes you give it. And you should/must
> assume that at the other end, your recv/read calls will return with between 0 and
> however many bytes you ask of them, with 0 meaning the remote has said it has
> nothing left to give.
>
Actually on a blocking socket 0 means other end has closed.
next prev parent reply other threads:[~2009-06-15 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-14 19:52 TCP partial write Paul Martin
2009-06-15 17:09 ` Rick Jones
2009-06-15 17:26 ` Stephen Hemminger [this message]
2009-06-15 17:59 ` Rick Jones
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=20090615102655.5059302d@nehalam \
--to=shemminger@vyatta.com \
--cc=netdev@vger.kernel.org \
--cc=rick.jones2@hp.com \
--cc=srucnoc@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.