What is the difference between connected and unconnected sockets?
Answer Posted / 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 |
Post New Answer View All Answers
What is the difference between read() and recv()?
How is a socket created?
How can I force a socket to send the data in its buffer?
Why sockets are used?
How many socket connections can a server handle?
What is a socket address?
What's the difference between impact sockets and regular sockets?
What is a socket api?
Can a single socket port be used for multiple applications?
What is active unix domain sockets?
How do I convert a string into an internet address?
What are the types of sockets?
Can multiple clients connect to same socket?
Why does it take so long to detect that the peer died?
How are unix domain sockets implemented?