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's the difference between a socket and a port?
What is difference between socket and websocket?
What is a socket address?
How does unix socket work?
Can multiple sockets use the same port?
How is a socket created?
What is socket programming in java?
Is socket a hardware or software?
What pieces of information make up a socket?
What is the purpose of socket?
Can a socket have multiple ports?
How many sockets can a cpu have?
What is a deep well socket?
Why does it take so long to detect that the peer died?
Why do we need sockets?