AFAIKS Svr.SendMessage takes a string and send it as a stream of characters. The SendMessage and GetMessage handlers to not implement anything to interpret a stream of characters as Pascal strings. You have to define your own protocol on top of this if you want to transfer complete string entities. Note that another behaviour you can see is that a long string gets broken up into separate chunks, so your GetMessage handler have to cater for this possibility too. It could be as simple as appending a special character (which then cannot be used as part of your message itself) such as CR or LF or both on the server side to delimit the end of a string, then on the client side you save the received data in a buffer, scan from the start of the buffer for the special delimiter. Once delimiter is found, move data from start to just before delimiter to your final string.
For a robust implementation consider the following cases in your code:
* A string gets chopped up into several fragments
* A string can be transferred as a complete packet (message)
* A packet (message) can contain a string + a fragment of or more than one string
I'm sure there are other TCP/IP components that implement this type of functionality but I haven't done any TCP/IP programming in a very long time.
Maybe slightly easier is to implement a ping-pong protocol where the server sends a string + delimiter then wait for the client to acknowledge the message before sending the next message.
There are probably lots of ways to implement this, perhaps you should tell us a bit more about your requirements.
PS:
Svr.SendMessage('a'+Chr(9)+'b'+Chr(9)+'c',Svr.Iterator);
can alternatively be written as:
Svr.SendMessage('a'#9'b'#9'c',Svr.Iterator);