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 are socket exceptions? What is out-of-band data?
What's the difference between a socket and a port?
What is socket address with example?
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
What is active unix domain sockets?
How come only the first part of my datagram is getting through?
When should I use UDP instead of TCP?
Whats the difference between select() and poll()?
What is a socket set used for?
What is LILO?
How do I get the port number for a given service?
Why does it take so long to detect that the peer died?