How do Sockets Work?
Answer / chaitanya
The implementation is left up to the vendor of your particular unix, but from the point of view of the programmer, connection-oriented sockets work a lot like files, or pipes. The most noticeable difference, once you have your file descriptor is that read() or write() calls may actually read or write fewer bytes than requested. If this happens, then you will have to make a second call for the rest of the data. There are examples of this in the source code that accompanies the faq.
| Is This Answer Correct ? | 0 Yes | 0 No |
What exactly does SO_LINGER do?
How come only the first part of my datagram is getting through?
Why sockets are used?
Is tcp or unix socket faster?
Where can a get a library for programming sockets?
How do I send [this] over a socket?
When should I use UDP instead of TCP?
How do I get the port number for a given service?
What is the purpose of socket?
What are raw sockets?
Why does it take so long to detect that the peer died?
Why do not my sockets close?