Q&A

  • 소켓통신중에 동적배열에 대해서..질문있습니다.
구조체 선언

Broker_Info_t           = record
    brokerID            : Word;
    stationID           : Word;
    parentBrokerIPcnt   : Byte;
    parentBrokerID      : Array of SmallInt;
    teansferSpeed       : LongWord;
    receivedPacketSize  : Int64;
    receivedPackerCount : LongWord;
    totalPacketCount    : LongWord;
end;

function TfrmMain.getLEInt(Socket: TCustomWinSocket): Integer;
var
  tmp, i : Integer;
  buf : array[0..3] of byte;
begin
    Socket.ReceiveBuf(buf, 4);
    tmp := 0;
    for i := 0 to 3 do
    begin
        tmp := tmp + (buf[i] shl (8 * (3 - i)));
    end;
    getLEInt := tmp;
end;


데이타 받는 부분

setLength(Broker_Info.parentBrokerID, Broker_Info.parentBrokerIPcnt);

for i := 0 to Broker_Info.parentBrokerIPcnt - 1 do

    Broker_Info.parentBrokerID[i] := getLESmallInt(Socket);

안녕하세요..자꾸..소켓이 먹통이 되는거 같아 질문을 드립니다.

소켓은 TClientSocket 을
0  COMMENTS