lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 15 Jun 2009 10:26:55 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Rick Jones <rick.jones2@...com>
Cc:	Paul Martin <srucnoc@...il.com>, netdev@...r.kernel.org
Subject: Re: TCP partial write

On Mon, 15 Jun 2009 10:09:29 -0700
Rick Jones <rick.jones2@...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.
--
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