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 sae socket?
What is active unix domain sockets?
What exactly is a socket?
If bind() fails, what should I do with the socket descriptor?
What is a socket address?
How do I use TCP_NODELAY?
How do I properly close a socket?
How can I set the timeout for the connect() system call?
What is the function of socket?
How many sockets can a cpu have?
What is a socket connection?
What is difference between socket and websocket?