My Testapp should give you an idea how to solve your problem. In my test-app I have implemented both, client AND server in one app. I also have added a lot of unnecessary eventhandlers for the client and the serversocket, which you do not need.

In both cases the Read-Event should be enought + the timer to send messages to the server.

Look especially to
ClientSocketRead
ServerSocketClientRead

You can see, that I have added the #13 as the message-seperator. Don't bother with the Random(100)=5. This is for simply generate your behaviour and test the reaction of the client.