I'm creating a client server application with Lazarus and synapse. And I must say that almost everything works. I can only understand why using these two pieces of code to send and receive strings sometimes read string dirty data of previous sending and receiving. How can I clean the buffer before sending any string?
thanks
function TMyClient.GetString: string;
var
buffer: String;
begin
buffer:='';
buffer := sock.RecvPacket(6000);
//buffer:=sock.RecvString(6000);
result:=buffer;
end;
function TMyClient.SendString(str: string): boolean;
begin
sock.SendString(str);
end;