What is the difference between connected and unconnected sockets?



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

Post New Answer

More Unix Socket Programming Interview Questions

How come I get address already in use from bind()?

1 Answers  


How can I tell when a socket is closed on the other end?

0 Answers  


What is a deep well socket?

0 Answers  


How would I put my socket in non-blocking mode?

1 Answers  


When will my application receive SIGPIPE?

1 Answers  






What is socket address?

0 Answers  


How do I send [this] over a socket?

1 Answers  


of the socket? Does doing a connect() call affect the receive behaviour?

1 Answers  


What are socket exceptions? What is out-of-band data?

1 Answers  


What is the purpose of socket?

0 Answers  


What's the difference between impact sockets and regular sockets?

0 Answers  


What is sae socket?

0 Answers  


Categories