TCPclient Code (Tidied)