Q&A

  • 이벤트가 오질 않습니다. 혹시 잘못된 부분이라도 있으면.... 알려 주십시오.
program UDPCaptures;

{$APPTYPE CONSOLE}

uses
        QForms,
        SyncObjs,
        SysUtils,
        Classes,
        IdGlobal,
        IdUDPServer,
        IdSocketHandle;

var
        UDPServero    : TIdUDPServer;
        FStrings      : TStrings;

type
TUDP = class( TObject )
        public
                constructor Create( AOwner: TComponent );
                procedure xUDPRead( Sender: TObject; aPacket: TStream; socketHandle: TIdSocketHandle );

        end;
{TUDP}


constructor TUDP.Create( AOwner:TComponent );
begin
        writeln('bbb');
end;

procedure TUDP.xUDPRead( Sender: TObject; aPacket: TStream; socketHandle: TIdSocketHandle );
var
        DataStringStream     : TStringStream;
        packetStrings           : TStringList;
        aString: String;
begin
:
:
:
:

        finally
                DataStringStream.Free;
        end;
end;

var
        xUDP : TUDP;
        fname : string;

begin
        try
:
:
:
:
:
        FStrings      := TStringList.Create;
        FSTrings.LoadFromFile('Configuration.ini');

        UDPServero := TIdUDPServer.Create( nil );
                xUDP := TUDP.Create(nil);


                writeln( UDPServero.localName );
                UDPServero.DefaultPort       := StrToInt( FStrings.Strings[1] );
                UDPServero.Bindings.add.Port := StrToInt( FStrings.Strings[2] );
                UDPServero.ReceiveTimeout    := StrToInt( FStrings.Strings[3] );
        UDPServero.ThreadedEvent := true;


                //xOnUDPRead := xUDPRead;
        UDPServero.OnUDPRead := XUDP.xUDPRead;   <--------------- 이부분을 class를 잡았음
                UDPServero.ThreadedEvent := true;
        UDPServero.Active := True;


                writeln(fname);
                while 0 > -1 do
                begin
                        application.Run;
                        sleep(1);
                end;

        finally
        end;

        exit;
end.

답변 부탁드립니다.
0  COMMENTS