Jump to content

Named Pipes (Russell Libby)


rafael.vieira
 Share

Recommended Posts

Hi everyone,

 

Does anyone use named pipes in a uniGui Web Project? In specifically Russel Libby?

I've tried to use (example below) but i didn't have success.

 

 

  private
    FServer : TPipeServer;
    FClient1 : TPipeClient;
 
    procedure OnClientPipeMessage(Sender : TObject; Pipe : NativeUInt; Stream : TStream);
    procedure OnServerPipeMessage(Sender : TObject; Pipe : NativeUInt; Stream : TStream);

 

 

procedure TUniFrame1.UniFrameCreate(Sender: TObject);

begin

  FServer := TPipeServer.Create(self);
  FServer.PipeName := 'test';
  FServer.Active := True;
  FServer.OnPipeMessage := OnServerPipeMessage;
 
  FClient1 := TPipeClient.Create(self);
  FClient1.PipeName := 'test';
  FClient1.OnPipeMessage := OnClientPipeMessage;
  if not FClient1.Connect then
    uniMemo1.Lines.Add('Not connected');

end;

 

procedure TUniFrame1.OnServerPipeMessage(Sender: TObject; Pipe: NativeUInt; Stream: TStream);
var S : String;
begin
  SetLength(S, Stream.Size);
  Stream.Read(S[1], Length(S));
  uniMemo1.Lines.Add(S);
end;
 
procedure TUniFrame1.UniButton1Click(Sender: TObject);
var S : String;
begin
  S := uniEdit1.Text;
  if Length(S) > 0 then
    FServer.Write(FServer.Clients[0], S[1], Length(S));
end;
 
procedure TUniFrame1.UniButton1Click(Sender: TObject);
var S : String;
begin
  S := uniEdit1.Text;
  if Length(S) > 0 then
    FServer.Write(FServer.Clients[0], S[1], Length(S));
end;
 
procedure TUniFrame1.UniButton2Click(Sender: TObject);
var S : String;
begin
  S := uniEdit2.Text;
  if Length(S) > 0 then
    FClient1.Write(S[1], Length(S));
end;
 

 

Ps: The unit Pipes is attached.

 

 

Pipes.rar

 

My uniGui version: 0.93.0.996

 

 

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...