put the stream reading and writing into separate functions in both Client.cs and TCPServer.cs