What is the Difference Between read() and recv() , and Between send() and write()?

Sajad Bahmani picture Sajad Bahmani · Nov 24, 2009 · Viewed 102.1k times · Source

What is the difference between read() and recv(), and between send() and write() in socket programming in terms of performances, speed and other behaviors?

Answer

Gonzalo picture Gonzalo · Nov 24, 2009

The difference is that recv()/send() work only on socket descriptors and let you specify certain options for the actual operation. Those functions are slightly more specialized (for instance, you can set a flag to ignore SIGPIPE, or to send out-of-band messages...).

Functions read()/write() are the universal file descriptor functions working on all descriptors.