modified tcpclient

copied the I/O handling from udp client to tcp client