improved runcmd functions

minor changes to TcpClient()