That doesn't seem to be the case.
Poll {} never closes an active socket
and always reaps the dead connections.
The interaction takes place in another procedure where a series of ipc like
things are done. Error checking is active at this level so that the poll process can go through and "cleanup" the global array. All sockets are closed
at the "ipc" level.
Poll{} does nothing but garbage collection. Thus, the first idea with a trace.
Here is a sample run

client)
-----------------------
telnet localhost 1200
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Username: mars
Password: ******
Please enter the name and alias host of the user: mars freddy
Transaction Successful::code=0
Connection closed by foreign host.
Server startup:
------------------------------
Junk collection:
Gvar(Parent) = sock3
Gvar(connections) = 0
Gvar(junkc) = 60000
Gvar(logfile) = /tmp/AliasChangeLog.txt
Gvar(max) = 2
Gvar(pwfile) = /home/mars/ausers.txt
Gvar(raddr) =
Gvar(resets) = 0
Gvar(sockids) =
Gvar(target) = /home/ding.txt
Gvar(worksock) =
---------------------------
During connect:
Gvar(Parent) = sock3
Gvar(connections) = 1
Gvar(junkc) = 60000
Gvar(logfile) = /tmp/AliasChangeLog.txt
Gvar(max) = 2
Gvar(pwfile) = /home/mars/ausers.txt
Gvar(raddr) = 127.0.0.1:40851
Gvar(resets) = 0
Gvar(sockids) = sock4
Gvar(target) = /home/ding.txt
Gvar(worksock) = sock4
-------------------------
After cleanup:
Gvar(Parent) = sock3
Gvar(connections) = 0
Gvar(junkc) = 60000
Gvar(logfile) = /tmp/AliasChangeLog.txt
Gvar(max) = 2
Gvar(pwfile) = /home/mars/ausers.txt
Gvar(raddr) = 127.0.0.1:40851
Gvar(resets) = 1
Gvar(sockids) = sock4
Gvar(target) = /home/ding.txt
Gvar(worksock) =
You can see there are still some things to fix. The sockid list needs to be purged or sorted uniquely. The raddr needs to be reset.
Yes, what you say about the client side is true. However, the program is very simple.
The server dictates the course of action.
If a transaction is valid it is processed,acknowledged and then closed.
Poll{} comes along and cleans up.
If it is invalid it is closed with an error message.
Poll{} comes along and cleans up.
Otherwise I must rely on tcl and the os
to know about broken pipes and other
accidents of this sort unless you have a better suggestion?