Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Nov 1996 14:06:50 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        fenner@parc.xerox.com (Bill Fenner)
Cc:        terry@lambert.org, jdp@polstra.com, scrappy@ki.net, jgreco@brasil.moneng.mei.com, hackers@freebsd.org
Subject:   Re: Sockets question...
Message-ID:  <199611152106.OAA26946@phaeton.artisoft.com>
In-Reply-To: <96Nov15.112419pst.177557@crevenia.parc.xerox.com> from "Bill Fenner" at Nov 15, 96 11:24:14 am

next in thread | previous in thread | raw e-mail | index | archive | help
> >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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611152106.OAA26946>