Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If this happens always, it literally means that the machine exists but that it has no services listening on the specified port, or there is a firewall stopping you.</p> <p>If it happens occasionally - you used the word "sometimes" - and retrying succeeds, it is likely because the server has a full 'backlog'.</p> <p>When you are waiting to be <code>accept</code>ed on a listening socket, you are placed in a backlog. This backlog is finite and quite short - values of 1, 2 or 3 are not unusual - and so the OS might be unable to queue your request for the 'accept' to consume.</p> <p>The backlog is a parameter on the <code>listen</code> function - all languages and platforms have basically the same API in this regard, even the <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.listen.aspx" rel="noreferrer">C# one</a>. This parameter is often configurable if you control the server, and is likely read from some settings file or the registry. Investigate how to configure your server.</p> <p>If you wrote the server, you might have heavy processing in the accept of your socket, and this can be better moved to a separate worker-thread so your accept is always ready to receive connections. There are various architecture choices you can explore that mitigate queuing up clients and processing them sequentially.</p> <p><em>Regardless</em> of whether you can increase the server backlog, you do need <strong><em>retry</em></strong> logic in your client code to cope with this issue - as even with a long backlog the server might be receiving lots of other requests on that port at that time.</p> <p>There is a rare possibility where a NAT router would give this error should it's ports for mappings be exhausted. I think we can discard this possibility as too much of a long shot though, since the router has 64K simultaneous connections to the same destination address/port before exhaustion.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload