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 |
How come I get address already in use from bind()?
How can I tell when a socket is closed on the other end?
What is a deep well socket?
How would I put my socket in non-blocking mode?
When will my application receive SIGPIPE?
What is socket address?
How do I send [this] over a socket?
of the socket? Does doing a connect() call affect the receive behaviour?
What are socket exceptions? What is out-of-band data?
What is the purpose of socket?
What's the difference between impact sockets and regular sockets?
What is sae socket?