[OT] why send()/recv() instead of write()/read()
Marc Lehmann
schmorp at schmorp.de
Wed Nov 3 19:26:24 CET 2010
On Tue, Nov 02, 2010 at 02:14:42PM -0600, AJ ONeal <coolaj86 at gmail.com> wrote:
> *send()* and *recv()*. Well, in short, I was being lazy. See, by using these
> system calls, I don't have to enter the *flags* argument that *send()* and *
> recv()* use, and I always set it to zero anyway. Of course, socket
Not only that, it means your code will be much more generic (it works with
non-sockets for example).
However, recv has the (nonportable) advantage of the MSG_DONTWAIT option
on many operating systems, which allows one to avoid changing fd flags on
shared fds, while send might have MSG_NOSIGNAL to avoid SIGPIPE, which cna
also be a nuisance.
Having said that, I always prefer read/write myself because I hate to
write code that only works with some fd types when it could work with all.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the libev
mailing list