added a check in tcpserver.cs for connected clients