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

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

1 Answers  


What's the difference between a socket and a port?

0 Answers  


What is socket address with example?

0 Answers  


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?

1 Answers  


What is active unix domain sockets?

0 Answers  






How come only the first part of my datagram is getting through?

1 Answers  


When should I use UDP instead of TCP?

1 Answers  


Whats the difference between select() and poll()?

0 Answers  


What is a socket set used for?

0 Answers  


What is LILO?

2 Answers  


How do I get the port number for a given service?

1 Answers  


Why does it take so long to detect that the peer died?

0 Answers  


Categories