Jump to content
Sign in to follow this  
Dmytro Lendel

how to send byte array with TWSocketClient

Recommended Posts

Hello,

How to send byte array with TWSocketClient?

 

I have byte array buffer: array[1..133] of byte

I found method Send but it`s working with TBytes

 

  PFirmWare = ^TFirmWare;
  TFirmWare = record
    buffer: array[1..133] of byte; 
  end;
--------------

procedure THWClient.SendXModemLine(Line: integer);

var
  buffer : TBytes;
begin

 if Assigned(SocketClient) then
  begin
    if (SocketClient.State=wsConnected) then
      begin
            SetLength(buffer, Length(PFirmWare(FXmodemFile.Items[Line])^.buffer));
            Move(PFirmWare(FXmodemFile.Items[Line])^.buffer, buffer, Length(PFirmWare(FXmodemFile.Items[Line])^.buffer));
            SocketClient.Send(buffer,Length(buffer)); <-- AV is here
      end;
  end;
end;

 

Can you help me please?

Regards Dmytro

 

Share this post


Link to post

Move(

  PFirmWare(FXmodemFile.Items[Line])^.buffer,

  buffer[0],

  Length(PFirmWare(FXmodemFile.Items[Line])^.buffer)

);

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×