Why do I get connection refused when the server is not running?



Why do I get connection refused when the server is not running?..

Answer / chaitanya

The connect() call will only block while it is waiting to establish a connection. When there is no server waiting at the other end, it gets notified that the connection can not be established, and gives up with the error message you see. This is a good thing, since if it were not the case clients might wait for ever for a service which just doesn't exist. Users would think that they were only waiting for the connection to be established, and then after a while give up, muttering something about crummy software under their breath.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Unix Socket Programming Interview Questions

Are unix sockets faster than tcp?

0 Answers  


What is a socket file?

0 Answers  


Why sockets are used?

0 Answers  


Is socket a hardware or software?

0 Answers  


What is a socket connection?

0 Answers  






Can a socket have multiple ports?

0 Answers  


What exactly does SO_LINGER do?

1 Answers  


What exactly does SO_REUSEADDR do?

1 Answers  


When should I use shutdown()?

1 Answers   Wipro,


How can I find the full hostname (FQDN) of the system I am running on?

1 Answers  


How can I write a multi-homed server?

0 Answers  


How can I read only one character at a time?

1 Answers  


Categories