Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2001 14:57:21 -0500
From:      Paul Marquis <pmarquis@pobox.com>
To:        Jim King <jim@jimking.net>
Cc:        Nate Williams <nate@yogotech.com>, Brian Matthews <blm@actzero.com>, Allen Landsidel <all@biosys.net>, freebsd-stable@FreeBSD.ORG
Subject:   Re: Threads vs. blocking sockets
Message-ID:  <3AC393A1.8B51FB45@pobox.com>
References:  <F0D64494733BD411BB9A00D0B74A0264021C9E@cpe-24-221-167-196.ca.sprintbbd.net> <15043.35980.669828.971544@nomad.yogotech.com> <00dd01c0b886$d8510250$524c8486@jking> <3AC390FD.6C03BF8F@pobox.com> <00f201c0b889$c4ff4d30$524c8486@jking>

next in thread | previous in thread | raw e-mail | index | archive | help
It's not.

If you request to send 100 bytes and the OS can only send 25 bytes,
the return value from send will be 25.  You then need to issue another
send with the 75 bytes that weren't sent.  Just because it's a partial
request, it's not an error, so -1 is not returned.

Jim King wrote:
> None of the documented values for errno as set by send(2) indicate "only
> part of the data was sent", at least by my reading.  Which value of errno
> indicates that I need to resend part of the data?  How do I tell how many
> bytes were sent?
> 
> Still sounds broken to me.
> 
> Jim
> 
> "Paul Marquis" <pmarquis@pobox.com> wrote:
> 
> > Under the manual entry for send(2), the RETURN VALUES section states:
> >
> >   The call returns the number of characters sent, or -1 if an
> >   error occured.
> >
> > So if you request to send 100 bytes, the OS may only be able to sent
> > half those and you need to check how many you sent an resend the part
> > that wasn't sent.
> >
> > Nate is right.
> >
> > Jim King wrote:
> > > Nate Williams wrote:
> > > > Again, all threading libraries I've used (not just on FreeBSD)
> *require*
> > > > the user to check that when sending/receiving data, the caller must
> make
> > > > sure that all the expected data has been sent/received.
> > >
> > > The man page for send(2) doesn't mention this.  It sounds broken to me.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3AC393A1.8B51FB45>