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 |
What is LILO?
What is the difference between close() and shutdown()?
How come only the first part of my datagram is getting through?
How often should I re-transmit un-acknowleged messages?
Can a single socket port be used for multiple applications?
What's the difference between a socket and a port?
What is socket address?
How come select says there is data, but read returns zero?
Can multiple clients connect to same socket?
What are socket exceptions? What is out-of-band data?
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?
How are unix domain sockets implemented?