[CentOS] socket: write vs send

Michael D. Berger

m_d_berger_1900 at yahoo.com
Tue Apr 6 19:16:15 UTC 2010


On CentOS 5.4,
Linux 2.6.18-164.6.1.el5 #1 SMP Tue Nov 3 16:18:27 EST 2009
   i686 i686 i386 GNU/Linux

In man 2 send I find:

  The  send()  call  may  be  used only when the socket is in a connected
  state (so that the intended recipient is known).  The  only  difference
  between  send()  and write() is the presence of flags.  With zero flags
  parameter,    send()    is    equivalent     to     write().

In some complex server software, if the client disconnects:
    send: delivers errno == ECONNRESET
but
    write: crashes the server process.

So it is not really equivalent.  Any thoughts on this?

Thanks,
Mike.




More information about the CentOS mailing list