zoukankan
html css js c++ java
Indy UDP端口冲突解决
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdUDPBase, IdUDPServer, StdCtrls,idsockethandle;
type
TForm1
=
class
(TForm)
Button1: TButton;
IdUDPServer1: TIdUDPServer;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R
*
.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ok:boolean ;
tempport:integer;
asockethandle:tidsockethandle;
begin
tempport:
=
idudpserver1.DefaultPort;
repeat
try
idudpserver1.Active:
=
true
;
ok:
=
true
;
except
on EIdCouldNotBindSocket
do
begin
IdUDPServer1.Active:
=
false
;
IdUDPServer1.Bindings.Clear;
ASocketHandle:
=
IdUDPServer1.Bindings.Add;
tempport:
=
tempport
+
1
;
ASocketHandle.Port:
=
tempport ;
end;
end;
until ok;
showmessage(inttostr(idudpserver1.Binding.Port));
end;
end.
loop's blog
查看全文
相关阅读:
利用Telnet来模拟Http请求 有GET和POST两种
WebConfig特殊字符的转义!
userprofile同步用户失败的原因和解决方案
linux mysql表名大小写
web.py 中文模版报错
docker 开启远程
web.py 笔记
python 安装influxdb-python
安装pip
influxdb 命令
原文地址:https://www.cnblogs.com/goodloop/p/62825.html
最新文章
day39,IO模型,select
day38,线程队列,协程
day37 GIL 和线程池 ,同步异步,回调函数
day36,多线程,线程中的锁机制,joinablequeue
day35,锁机制
day34,进程
day33 udp
day32,半连接数,粘包,自定义报头
day31,socket 客户端 服务端
偏函数
热门文章
装饰器
匿名函数
高阶函数:sorted
高阶函数:filter()
函数式编程
生成器
列表生成式
迭代器
未能找到类型或命名空间名称“XXXX”(是否缺少 using 指令或程序集引用?)
.NET读取Project 2007 MPP项目文件
Copyright © 2011-2022 走看看