TServerSocket and TClientSocket problems?

   I am writing 2 applications in Delphi 3.0 C/S and am having
problems. The first application contains a TServerSocket and is
run on several computers on a LAN. The other program is run on
a different computer and has a TClientSocket for each TServerSocket.

   At first I tried to reopen the TClientSocket in the OnError
event but it didn't seem like it was trying to connect after a

   Now I try to reopen all closed TClientSockets every 2 or 4
seconds (don't remember exactly) and set the ErrorCode := 0 in
the OnError event of the ClientSockets (I use the same procedure
for all the sockets). If one of the ServerSocket programs are
not running, the ClientSocket program runs for several minutes
then starts giving me an Error every 2 or 4 seconds (as if I'm
not resetting the ErrorCode).

   Another problem I have is when I send data from the ServerSocket
when the ClientSocket has just been closed using:

if ServerSocket1.Socket.ActiveConnections > 0 then

   I get an error message even though I reset the ErrorCode := 0 in the

   Can anyone help?