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
查看全文
相关阅读:
[LeetCode] 582. Kill Process
[LeetCode] 686. Repeated String Match
[LeetCode] 341. Flatten Nested List Iterator
[LeetCode] 404. Sum of Left Leaves
[LeetCode] 366. Find Leaves of Binary Tree
[LeetCode] 1485. Clone Binary Tree With Random Pointer
[LeetCode] 459. Repeated Substring Pattern
[LeetCode] 565. Array Nesting
[LeetCode] 679. 24 Game
[LeetCode] 364. Nested List Weight Sum II
原文地址:https://www.cnblogs.com/goodloop/p/62825.html
最新文章
Servlet系列教材 (二十五)- JSON
Servlet系列教材 (二十四)- CRUD
Servlet系列教材 (二十三)- CRUD
Servlet系列教材 (二十二)- CRUD
Servlet系列教材 (二十一)- CRUD
codeforces722——C.Destroying Array(并查集+栈+逆向思维)
codeforces731——C. Socks(并查集)
codeforces118——D. Caesar‘s Legions(DP)
UPC—— 最勇敢的机器人(并查集+分组背包)
codeforces446—— A.DZY Loves Sequences(DP+枚举)
热门文章
codeForces416——B.Art Union(模拟)
codeforces455——A. Boredom(线性DP)
codeforces327——A. Flipping Game(前缀和)
codeforces1210——A.Anadi and Domino(思维+枚举)
codeforces1209——D.Cow and Snacks(并查集)
[LeetCode] 657. Robot Return to Origin
[LeetCode] 706. Design HashMap
[LeetCode] 251. Flatten 2D Vector
[LeetCode] 284. Peeking Iterator
[LeetCode] 281. Zigzag Iterator
Copyright © 2011-2022 走看看