Why do I get connection refused when the server is not running?
Answer Posted / 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 View All Answers
Why do we need socket programming?
Why do we need sockets?
What exactly is a socket?
What is difference between socket () and serversocket () class?
Why sockets are used?
How does a socket work?
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
What is a deep well socket?
How do I use TCP_NODELAY?
What is the function of socket?
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
How can I tell when a socket is closed on the other end?
Why do I get EPROTO from read()?
Can a socket have multiple ports?
What is socket programming in java?