Q&A

  • udp을 사용했는데 Stream error가 뜨네요...
안녕하세요?
udp을 사용했는데 Stream error가 뜨네요
안 뜨는 방법좀 가르쳐 주세요

참고로..
var
  MyStream : TMemoryStream;
  TmpStr   : String;
  CmdChk   : String;
begin
  MyStream := TMemoryStream.Create;
  try
    NMUDP1.ReadStream(MyStream);
    SetLength(TmpStr,NumberBytes);
    MyStream.Read(TmpStr[1],NumberBytes);
    CmdChk := Copy(TmpStr,1,6);

    if CmdChk = 'REBOOT' Then begin
       MyExitWindows(EWX_REBOOT or EWX_FORCE);
    end;

  finally
    MyStream.Free;
  end;
end;
이렇게 했는데도 뜨네요....
1  COMMENTS
  • Profile
    구창민 2004.12.19 03:14
    안녕하세요..

    간단한 예문을 올릴께요..

    보시고 참고 하세요..


    procedure UDPServerUDPRead(Sender: TObject; AData: TStream;
      ABinding: TIdSocketHandle);
    var
      StringStream: TStringStream;
      Buffer, Command, TmpStr: string;
    begin
      StringStream := TStringStream.Create('');
      try
        StringStream.CopyFrom(AData, AData.Size);
        Buffer := StringStream.DataString;
      finally
        DataStream.Free;
      end;

      Command := Copy(Buffer, 1, 6);
      if Trim(Command) = REBOOT' then
      begin
         ... 처리..