Implement tcp server and client.