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 socket address with example?
Whats the difference between select() and poll()?
What is the difference between close() and shutdown()?
What is with the second parameter in bind()?
Why sockets are used?
What is difference between socket () and serversocket () class?
What's the difference between impact sockets and regular sockets?
Why do I keep getting EINTR from the socket calls?
What does af mean in sockets?
How can I put a timeout on connect()?
How do I get the port number for a given service?
How would I put my socket in non-blocking mode?