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
Are sockets files?
What is a sae socket?
Why do we need sockets?
What does af mean in sockets?
What is the difference between read() and recv()?
What is socket programming in java?
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
What is active unix domain sockets?
Whats the difference between select() and poll()?
How can I set the timeout for the connect() system call?
Why sockets are used?
How many socket connections can a server handle?
How are unix domain sockets implemented?
Is socket a hardware or software?
How is a socket created?