procedure TForm1.ToolButton5Click(Sender: TObject);
begin
  with dm.cmpq do begin
        first;
        while not eof do begin
            sendon;//自定义过程
            pudpDataReceived(Sender: TComponent; NumberBytes: Integer;FromIP: String; Port: Integer);//就是这儿不能调用。
            //////////////////////////////////
            /// 加上下面的语句试试:
            sleep(1000); 
            ////////////////////////
            next;
        end;
    end;
end;

解决方案 »

  1.   

    我现在首先想明白的问题是UDP的datareceived事件能否调用,我这儿还有错,
    [Error] Unit1.pas(323): Incompatible types: 'TComponent' and 'TObject'
    [Error] Unit1.pas(323): Undeclared identifier: 'NumberBytes'
    [Error] Unit1.pas(323): ':=' expected but ':' found
    [Error] Unit1.pas(323): ':=' expected but ':' found
    [Error] Unit1.pas(323): ')' expected but ':' found
    [Error] Unit1.pas(324): Missing operator or semicolon[Fatal Error] jkserver.dpr(14): Could not compile used unit 'Unit1.pas'
      

  2.   

    pudpDataReceived(Sender: TComponent; NumberBytes: Integer;FromIP: String; Port: Integer); 只是函数说明啊~
    你要把相应的参数填进去啊~
      

  3.   

    Declaration
    property OnDataReceived: TOnReceive;Description
    The OnDataReceived event is called when data is received from the remote hostEvent Parameters:
    The NumberBytes parameter specifies the number of incoming bytes.
    The FromIP parameter specifies the IP address of the computer that sent the data.
    The Port property specifies which port the data was sent from.
      

  4.   

    声明的时候有问题呀!!
    [Error] Unit1.pas(71): INDEX, READ or WRITE clause expected, but ';' found
    [Error] Unit1.pas(72): READ or WRITE clause expected, but identifier 'private' found
    [Fatal Error] Unit1.pas(85): Could not compile used unit 'Unit8.pas'