What is the difference between connected and unconnected sockets?
Answer / chaitanya
If a UDP socket is unconnected, which is the normal state after a bind() call, then send() or write() are not allowed, since no destination address is available; only sendto() can be used to send data.
Calling connect() on the socket simply records the specified address and port number as being the desired communications partner. That means that send() or write() are now allowed; they use the destination address and port given on the connect call as the destination of the packet.
| Is This Answer Correct ? | 1 Yes | 0 No |
What is a deep well socket?
What are Sockets?
Why do I get connection refused when the server is not running?
Where is the socket located?
After the chroot(), calls to socket() are failing. Why?
What exactly is a socket?
What is the difference between connected and unconnected sockets?
Can multiple sockets use the same port?
What is active unix domain sockets?
What's the difference between a socket and a port?
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
What exactly does SO_KEEPALIVE do?