Delphi Write Multi parameters in Named Pipes

249 views Asked by At

In Delphi i'm using "Libby's pipes.pas" this Unit https://micksmix.wordpress.com/2011/06/27/named-pipes-unit-for-delphi/

I'm able to communicate with another process, my problem comes when i want to pass more than one parameter, and the size is not fixed. Like wanting to write 1 array of bytes plus 2 dwords. And in the server shall i guess the length of the 1st parameter? I don't think so. Hope somebody that had been messing with this unit would know how to point me in the right way.

Thanks in advance.

    procedure SendDatapipe(buf:TArray<Byte>;tipe,siz:dword);
    begin
    if FClient1=nil then begin
    FClient1 := TPipeClient.CreateUnowned;
    FClient1.PipeName := 'PipeServer';
    if FClient1.Connect=False then
    FClient1:=nil;
    end;
    if (FClient1<>nil) and (FClient1.connected=FALSE) then
    FClient1.Connect;
    if (FClient1<>nil) and (FClient1.connected) then

    FClient1.Write(buf[0], Length(buf));
//WHAT ELSE?
    FClient1.FlushPipeBuffers;
    FClient1.Free;
    end;

I noticed that FClient1.Write can also use a "PRefix", i'm not sure whether this is what i'm looking for.

0

There are 0 answers