The TCP stack has some race conditions which can
result in in correct operation. This is espesially true in
the setState function where the state can be changed
before the connection is truely in the new state. Then,
another thread can try to perform operations which are
based on the state before critical actions have taken
place. This has cause proplems with change state to
closed in one thread, then re-opening the socket in
another thread before the thread that closed the socked
has finished cleaning up the socket. This clean up can
actual happen after the second thead has preformed a
listen or other such operation, there by effectively
closing a connection whose state indicated that it is
open.