 
          Per ovviare al problema che un socket rimane occupato con una connessione Tcp è possibile ovviare al problema configurando come segue l’istanza di una classe TidTcpclient:
per effettuare la connessione:
 
 IdTCPClient.BoundIP := currentIp;
 IdTCPClient.Port := 5566;
 IdTCPClient.Host := ;
 IdTCPClient.Connect;
 
invece nel metodo disconnect :
uses .... IdIPWatch,IdStackConsts ....
  if IdTCPClient.Connected then
   begin
     IdTCPClient.Socket.Binding.SetSockOpt(id_sol_socket,id_so_dontlinger,id_so_true);
     if IdTCPClient.IOHandler <> nil then
       try IdTCPClient.IOHandler.InputBuffer.Clear; except end;
     try IdTCPClient.Disconnect; except end;
   end;