netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael T Kerrisk" <mtk-lists@gmx.net>
To: netdev@oss.sgi.com
Subject: Strangeness when write()-ing zero-length datagrams
Date: Mon, 9 Aug 2004 16:38:13 +0200 (MEST)	[thread overview]
Message-ID: <19357.1092062293@www39.gmx.net> (raw)

Godday,

On Linux 2.4.26 and 2.6.7, if we connect a datagram socket and 
then use write() to send 0 bytes, a datagram is NOT generated 
(this happens in both the Unix and Internet domains).  
Datagrams are generated in this case for send() and sendto() 
though.  

As far as I can work out, this occurs because of the 
following code in net/socket.c::sock_write/sock_aio_write():

    if(size==0)        /* Match SYS5 behaviour */
        return 0;

Is the Linux behaviour intended?  It seems counterintuitive, 
and it does not match what I see on other systems:

Solaris 8 does not behave like Linux in this case -– a zero 
length datagram is sent and read by the receiver (tested for 
Internet and Unix domain sockets).

Tru64 5.1 is the same as Solaris 8 (tested for Internet and 
Unix domain sockets)

HP-UX 11 is the same as Solaris 8 (tested for Internet and 
Unix domain sockets)

FreeBSD 4.9 and 5.1 are the same as Solaris 8 (tested for 
Internet and Unix domain sockets)

Cheers,

Michael

-- 
Michael Kerrisk
mtk-lists@gmx.net

NEU: WLAN-Router für 0,- EUR* - auch für DSL-Wechsler!
GMX DSL = supergünstig & kabellos http://www.gmx.net/de/go/dsl

             reply	other threads:[~2004-08-09 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-09 14:38 Michael T Kerrisk [this message]
2004-08-09 15:40 ` Strangeness when write()-ing zero-length datagrams bert hubert
2004-08-09 15:59   ` Michael T Kerrisk

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=19357.1092062293@www39.gmx.net \
    --to=mtk-lists@gmx.net \
    --cc=netdev@oss.sgi.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 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).