[Haskell-cafe] Re: Coming up with a better API for
barsoap at web.de
Thu Feb 26 23:41:10 EST 2009
"Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu> wrote:
> On 2009 Feb 26, at 16:45, Johan Tibell wrote:
> > definition of `recv` would look like. My current thinking is that it
> > would mimic what C/Python/Java does and return a zero length
> > ByteString when EOF is reached.
> Ew. Isn't this what Maybe is for?
> Anyway, the reason recv doesn't return 0 is that if you have a
> datagram socket, a zero-length recv is valid and doesn't mean EOF.
My man page says a retval of 0 means that "the peer has performed an
orderly shutdown", which, in the UDP case, means that it has send a
complete datagram... no mention of EOF. A true EOF in the sense of "no
more data will be received" would mean unbinding the socket.
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.
More information about the Haskell-Cafe