Send array of string using tcp
- by user2798455
I'm not sure if this is possible but here it goes.
Usually I send strings like this...
Connection.IOHandler.WriteLn('alpha');
Connection.IOHandler.WriteLn('bravo');
Connection.IOHandler.WriteLn('charley');
//and so on..
But what if I want to send it in just one go, just send it all at once.
Maybe I could put it on an array of strings then send the array.
someStr : array[1..3] of string = ('alpha','bravo','charley');//this could be more
...
StrListMem := TMemoryStream.Create;
try
StrListMem.WriteBuffer(someStr[0], Length(someStr));
StrListMem.Position:=0;
Connection.IOHandler.Write(StrListMem, 0, True);
finally
StrListMem.Free;
end;
I just have no idea how to this right, maybe somebody can give an example? and how the receiver(client) will read it.