[OT] why send()/recv() instead of write()/read()
amery at geeks.cl
Wed Nov 3 20:02:22 CET 2010
On Wed, Nov 3, 2010 at 19:26, Marc Lehmann <schmorp at schmorp.de> wrote:
> 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.
thanks, that's exactly what I wanted to hear :)
More information about the libev