Hi, 

I started use Synapse few days ago. I’m trying to use the function
SendStream(TTCPBlockSocket), but it seems that doesn´t work properly. I can
send all bytes but the receiver side get the stream (or a file) corrupted. 

So I tried a workaround splitting my package in some blocks, then sending
this blocks separated. It worked, but not fast as Indy or Delphi native
component does…

I would like to improve the performance. Did anyone experience this same
situation? Any tip or clue are welcome. 

 

Below is my function….

 

Procedure EnviarStream(ACaminho: string);

var

  Stream: TFileStream;

  BufLen: Integer;

  Buffer: array [0 .. 1023] of Byte;

  i: Integer;

begin

  try

    if (_socket <> nil) and (socket.Socket <> 0) then

    begin

      Stream := TFileStream.Create(ACaminho, fmOpenRead or fmShareDenyNone);

      repeat

        BufLen := Stream.Read(Buffer, SizeOf(Buffer));

        socket.SendBuffer(@Buffer, BufLen);

      until (BufLen = 0);

    end;

  finally

    FreeAndNil(Stream);

  end;

end;

 

With the SendStream I tried this:

 

Procedure EnviarStream(ACaminho: string);

var

  Stream: TFileStream;

begin

  try

    if (_socket <> nil) and (socket.Socket <> 0) then

    begin

      Stream := TFileStream.Create(ACaminho, fmOpenRead or fmShareDenyNone);

       socket.SendStream(Stream);

  finally

    FreeAndNil(Stream);

  end;

end;

 

Am I doing something wrong?

 

Thanks in advance

 

 

Descrição: Description: Description: Description: Logo Scenario


Filipe Gebara
DESENVOLVIMENTO

Scenario - Automação Residencial 
(16) 3361-2441 - São Carlos 
 <mailto:fil...@scenario.ind.br> fil...@scenario.ind.br

 <http://www.scenario.ind.br/> www.scenario.ind.br

 

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to