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 with the second parameter in bind()?
What are Sockets?
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 is a socket set used for?
Why do not my sockets close?
Is socket a hardware or software?
How are unix domain sockets implemented?
How do I get the port number for a given service?
What is sae socket?
How do I convert a string into an internet address?
How to find other end of unix socket connection?
What is af_inet in socket?