Network Connection

Learn about how a network connection is made, and how the failures can occur in creating a network connection.

Listen queue

Suppose that the remote application is listening to the port but is absolutely hammered with connection requests, until it can no longer service the incoming connections. The port itself has a “listen queue” that defines how many pending connections (SYN sent, but no SYN/ACK replied) are allowed by the network stack.

Once the listen queue is full, further connection attempts are refused quickly. The listen queue can cause issues for many systems. While the socket is in the listen queue, whichever thread called open() is blocked inside the OS kernel until the remote application finally gets around to accepting the connection or until the connection attempt times out. Connection timeouts vary from one operating system to another, but they’re usually measured in minutes!

The blocked requests

The calling application’s thread could be blocked waiting for the remote server to respond for ten minutes! A similar thing happens when the caller connects and sends its request but the server takes a long time to read the request and send a response.

Get hands-on with 1200+ tech skills courses.