porton
porton

Reputation: 5827

When socket timeout happens? (Unix)

When I connect to a Unix named socket, under which conditions I may receive ETIMEDOUT?

If it happens when the server does not accept() during N seconds, then what are typical N on Linux?

Upvotes: 2

Views: 3232

Answers (1)

Barmar
Barmar

Reputation: 782785

It happens if the server's operating system doesn't accept the connection within N seconds. The server application calling accept() is not normally relevant, because the operating system performs the 3-way handshake automatically, regardless of whether the application calls accept(); the TCP stack queues up the pending connections until the application does this (up to a backlog limit).

So normally this timeout only occurs if the server is physically down or there's a communication error on the network.

I think the default on Linux is 20 seconds.

Upvotes: 1

Related Questions