Sorry, the code is at work on a private network, so there is no way to post it.

I guess I don't know what you mean by how did I implement it. The client simply establishes a socket and then waits to connect to the server. Once the the connection is made the sever then writes some data to the socket and waits for a response. The client reads the data off the socket and then writes data back to the socket. This is where both the server and client end up attempting to read at the same time from the socket. The client ends up with the data however. Since the server has not sent anything at this point I don't understand why it would read anything. The server should end up with this data. And again, the client has a read thread and a write thread. The server is simply a single thread of execution.