Sockets: when and how to close them?

Johannes Waldmann joe@isun.informatik.uni-leipzig.de
Wed, 7 Nov 2001 14:54:12 +0100 (MET)


When using Sockets, exactly when and where do I have to close them?

The documentation (of module Socket) implies that this is not necessary?
However there is sClose in SocketPrim. My application is one Server
who runs `listenOn' and many (short lived) clients that `connectTo'.
After I run this for a while, netstat typically says

autotool@isun11:~/autotool/serial$ netstat|grep local
localhost.9121       localhost.56749      32768      0 32768      0 CLOSE_WAIT
localhost.56749      localhost.9121       32768      0 32768      0 FIN_WAIT_2
localhost.9121       localhost.56753      32768      0 32768      0 CLOSE_WAIT
localhost.56753      localhost.9121       32768      0 32768      0 FIN_WAIT_2

although some seem to vanish after a while (some minutes). Best regards,
-- 
-- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ --
-- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --