Questions tagged [so-linger]

SO_LINGER is the BSD Sockets option to control whether `close()` blocks while pending data is being sent, and if so for how long. By default it is off. It has nothing to do with the TIME_WAIT interval.

SO_LINGER is the BSD Sockets option to control whether close() blocks while pending data is being sent, and if so for how long. By default it is off. It has nothing to do with the TIME_WAIT interval.

8 questions
118
votes
8 answers

When is TCP option SO_LINGER (0) required?

I think I understand the formal meaning of the option. In some legacy code I'm handling now, the option is used. The customer complains about RST as response to FIN from its side on connection close from its side. I am not sure I can remove it…
dimba
  • 26,717
  • 34
  • 141
  • 196
3
votes
2 answers

SO_LINGER and closing sockets(WINSOCK)

im writing a multithreaded winsock application and im having some issues with closing the sockets. first of all, is there a limit for a number of simultaneously open sockets? lets say like 32 sockets all in once. i establish a connection on one of…
Johnny Walked
  • 31
  • 1
  • 2
2
votes
2 answers

Why isn't SO_LINGER option with a 0 timeout or 10 second timeout not removing sockets immediately or after 10 seconds?

I have read When is TCP option SO_LINGER (0) required? and several other related questions and answers but I am unable to reproduce any of the SO_LINGER behavior explained in these posts. I will share one of my many experiments here. I am performing…
Lone Learner
  • 18,088
  • 20
  • 102
  • 200
2
votes
0 answers

Determining the moment a TCP connection is really been closed in C

I need to perform some operations only after the time a TCP connection is fully closed, that's to say - all the data segments, as well as the finishing routine (FIN-ACK or RST) have been performed and done, and no packets will be sent on the…
Reflection
  • 1,936
  • 3
  • 21
  • 39
1
vote
0 answers

Closing a socket with SO_LINGER does not send RST packet

When closing a TCP connection with a client, the client application will only visibly respond to the user when the connection is reset (an RST packet is sent). For now, I cannot modify the client application. When researching this, the primary way…
ninjaprawn
  • 11
  • 1
1
vote
1 answer

Shouldn't set SoLinger to false cut this connection?

From what I understand, linger is a setting allowing to keep the connection some delay after close for the final data to have time to be read. I have this example: @Ignore public class SocketTTest { @Test public void socketTest() throws…
Winter
  • 3,894
  • 7
  • 24
  • 56
0
votes
1 answer

What happens to lingering sockets when the kernel reboots?

I'm trying to understand what the typical behavior for the following scenario. Please note I'm open to finding out more about this edge case for any OS (*nix, Windows, ...). If an application is blocked waiting or a lingering socket to close, what…
stconnell
  • 56
  • 2
-1
votes
1 answer

Scala spray immediately close connection after send answer

How scala spray immediately close connection after send answe? In other http server Im set tcp optionsso_linger` = 0 Where I can set so_linger param in spray_can?