Recent

Author Topic: Send string with synapse  (Read 1894 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Send string with synapse
« on: May 23, 2015, 01:40:13 pm »
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
Code: [Select]
function TMyClient.GetString: string;
var
   buffer: String;
begin
     buffer:='';
     buffer := sock.RecvPacket(6000);
     //buffer:=sock.RecvString(6000);
     result:=buffer;
end;     

Code: [Select]
function TMyClient.SendString(str: string): boolean;
begin
     sock.SendString(str);
end;     
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018