Avoid TIME_WAIT state, server side: wait for client to close connection.
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Sun, 2 Feb 2014 20:49:14 +0000 (21:49 +0100)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Sun, 2 Feb 2014 20:49:14 +0000 (21:49 +0100)
commitc4ee91659b988bb0218441f8117569f87cdd10c9
tree683cc0bac884184773fb7e2a8480470eb08a9108
parentfd5ef816e3a5d2ee195feba5fe2819436072d955
Avoid TIME_WAIT state, server side: wait for client to close connection.

See:
http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable
http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html
http://stackoverflow.com/questions/3757289/tcp-option-so-linger-zero-when-its-required

By the way, never use SO_LINGER. The application level protocol should be implemented
in such way that allows the client side to find out when server side ended up sending
data and in this way the client is able to close the connectiond and server side does not
finish with sockets in TIME_WAIT state.
Daemon/javafork.c
JavaExample/javafork-example/src/main/java/de/fork/java/TCPForkDaemon.java
JavaExample/pom.xml