From owner-freebsd-hackers Fri Nov 15 13:31:25 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA17762 for hackers-outgoing; Fri, 15 Nov 1996 13:31:25 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id NAA17753 for ; Fri, 15 Nov 1996 13:31:13 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id OAA26946; Fri, 15 Nov 1996 14:06:50 -0700 From: Terry Lambert Message-Id: <199611152106.OAA26946@phaeton.artisoft.com> Subject: Re: Sockets question... To: fenner@parc.xerox.com (Bill Fenner) Date: Fri, 15 Nov 1996 14:06:50 -0700 (MST) Cc: terry@lambert.org, jdp@polstra.com, scrappy@ki.net, jgreco@brasil.moneng.mei.com, hackers@freebsd.org In-Reply-To: <96Nov15.112419pst.177557@crevenia.parc.xerox.com> from "Bill Fenner" at Nov 15, 96 11:24:14 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > >How do I read into a structure on a machine that demands aligned > >data access? > > You read into an intermediate buffer and copy it. You have to convert from > network to machine representation anyway, so this isn't (much) more overhead. DCE RPC does not do a conversion if both ends are the same byte order. BSD RPC does not do a conversion on hardware with correct endianess. I think this is why #pragma pack was invented. 8-(. > >nothing would work at all if you couldn't issue a read for n > >bytes that didn't complete until you *got* n bytes. > > Well, I guess the BSD networking code has probably never worked at all. > The read() system call on a socket is based on soreceive(), which > returns up to N bytes. On a non-blocking socket, right? Or in the case of a blocking call for more bytes than SO_RECVBUF (which you can determine via getsockopt and therefore never trigger). Can it return less than N otherwise? The WAITALL case is only for the user buffer larger than SO_RECVBUF, right? Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.