⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a.~pas

📁 采用Delphi编程
💻 ~PAS
字号:
unit a;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, CnUDP, StdCtrls;

type
  TForm1 = class(TForm)
    udp1: TCnUDP;
    mmo1: TMemo;
    btn1: TButton;
    procedure udp1DataReceived(Sender: TComponent; Buffer: Pointer;
      Len: Integer; FromIP: String; Port: Integer);
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.udp1DataReceived(Sender: TComponent; Buffer: Pointer;
  Len: Integer; FromIP: String; Port: Integer);
begin
  mmo1.Lines.Add(FromIP);
end;

procedure TForm1.btn1Click(Sender: TObject);
var
 sBuff:array [1..1024] of Char;
 sInfo:String;
begin
 sInfo:='hello world!';
 sBuff:=sInfo;
 udp1.SendBuffer(sBuff,Length(sBuff));
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -