isolate tcpstream connection code to tcpclient module