Implementation of a TCP client