摘要:
UDP就比较简单了,放个按钮,一个TIdUDPServerTIdUDPServer绑定 0.0.0.0:3820,然后Active设置为True//发送按钮procedure TForm1.Button1Click(Sender: TObject);varIdUDPClient1: TIdUDPClient; //动态创建TIdUDPClientbeginIdUDPClient1:=TIdUDPClient.Create;IdUDPClient1.BroadcastEnabled:=true;tryIdUDPClient1.Port:=3820;IdUDPClient1.Host:=' 阅读全文
摘要:
先来个TCP的:放两个TMemo,分别叫:Memo_Input, Memo_out 一个输入,一个输出IdTCPServer1的Bindings里,设置 0.0.0.0:3999,ActibveIdTCPClient1的Port设3999发送按钮的代码:varbufSend: TMemoryStream;begintry//连接IdTCPClient1.Connect(Edit_IP.Text);exceptMemo_out.Lines.Add(Edit_IP.Text+' 连接超时!'); Exit;end;//准备发送bufSend:=TMemoryStream.Creat 阅读全文