From owner-freebsd-stable Thu Mar 29 11:57: 9 2001 Delivered-To: freebsd-stable@freebsd.org Received: from mail.infolibria.com (mail.infolibria.com [12.30.17.31]) by hub.freebsd.org (Postfix) with ESMTP id 1A63437B71A for ; Thu, 29 Mar 2001 11:57:04 -0800 (PST) (envelope-from pmarquis@pobox.com) Received: from pobox.com (gw.infolibria.com [12.30.17.254]) by mail.infolibria.com (Postfix) with ESMTP id 0FA7215CC04; Thu, 29 Mar 2001 14:54:30 -0500 (EST) Message-ID: <3AC393A1.8B51FB45@pobox.com> Date: Thu, 29 Mar 2001 14:57:21 -0500 From: Paul Marquis X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Jim King Cc: Nate Williams , Brian Matthews , Allen Landsidel , freebsd-stable@FreeBSD.ORG Subject: Re: Threads vs. blocking sockets References: <15043.35980.669828.971544@nomad.yogotech.com> <00dd01c0b886$d8510250$524c8486@jking> <3AC390FD.6C03BF8F@pobox.com> <00f201c0b889$c4ff4d30$524c8486@jking> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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" 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