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
Why do I get EPROTO from read()?
What does af mean in sockets?
What's the difference between impact sockets and regular sockets?
How many socket connections can a server handle?
What is a socket connection?
Can a socket have multiple ports?
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
How many sockets can a cpu have?
Can multiple clients connect to same socket?
What's better 6pt or 12pt sockets?
How to find other end of unix socket connection?
What is the purpose of socket?
Why does the sockets buffer fill up sooner than expected?
How is a socket created?
What is a socket file?