Date: Fri, 15 Nov 1996 11:32:55 PST From: Bill Fenner <fenner@parc.xerox.com> To: Terry Lambert <terry@lambert.org> Cc: fenner@parc.xerox.com (Bill Fenner), scrappy@ki.net, jdp@polstra.com, hackers@freebsd.org Subject: Re: Sockets question... Message-ID: <96Nov15.113305pst.177557@crevenia.parc.xerox.com> In-Reply-To: Your message of "Fri, 15 Nov 96 10:58:51 PST." <199611151858.LAA26626@phaeton.artisoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96Nov15.113305pst.177557>