From owner-freebsd-hackers Fri Nov 15 11:34:00 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA10921 for hackers-outgoing; Fri, 15 Nov 1996 11:34:00 -0800 (PST) Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id LAA10916 for ; Fri, 15 Nov 1996 11:33:53 -0800 (PST) Received: from crevenia.parc.xerox.com ([13.2.116.11]) by alpha.xerox.com with SMTP id <16073(6)>; Fri, 15 Nov 1996 11:33:17 PST Received: from localhost by crevenia.parc.xerox.com with SMTP id <177557>; Fri, 15 Nov 1996 11:33:05 -0800 To: Terry Lambert cc: fenner@parc.xerox.com (Bill Fenner), scrappy@ki.net, jdp@polstra.com, hackers@freebsd.org Subject: Re: Sockets question... In-reply-to: Your message of "Fri, 15 Nov 96 10:58:51 PST." <199611151858.LAA26626@phaeton.artisoft.com> Date: Fri, 15 Nov 1996 11:32:55 PST From: Bill Fenner Message-Id: <96Nov15.113305pst.177557@crevenia.parc.xerox.com> Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In message <199611151858.LAA26626@phaeton.artisoft.com> you write: >So at the "read" interface, you *can* count on it arriving in the >same sized chunks as you wrote it No, you can *never* count on that, since non-blocking reads from a stream socket return as much data as is available, which could be less than you asked for. See soo_read() (or soo_rw() in earlier BSD's) and soreceive(). 4.4BSD introduced the MSG_WAITALL flag, so if you use recv() or any of its friends you can ask for your whole request to be performed. This is, of course, not portable, and MSG_WAITALL won't even do the trick if your request is larger than the socket's high water mark (e.g. SO_RECVBUF). Bill