1
16cy
Unregistered / Unconfirmed
GUEST, unregistred user!
这段程序有点不理解:
var
Binding : TIdSocketHandle;
begin
...
for i := 0 to lbIPs.Count-1 do
if lbIPs.Checked then
begin
Binding := IdTCPServer.Bindings.Add;
Binding.IP := lbIPs.Items.Strings;
Binding.Port := StrToInt(edtPort.Text);
SL.append('Server bound to IP ' + Binding.IP + ' on port ' + edtPort.Text);
end;
IdTCPServer.Active := true;
result := IdTCPServer.Active;
fServerRunning := result;
lbProcesses.Items.AddStrings(SL);
lbProcesses.Items.Append('Server started');
...
end;
变量binding并不是idTCPserver的一部分。那么这
Binding := IdTCPServer.Bindings.Add;
Binding.IP := lbIPs.Items.Strings;
Binding.Port := StrToInt(edtPort.Text);
就不能把IP和port的值赋给idTCPServer啊?那这段话有什么用处?
Binding := IdTCPServer.Bindings.Add;
这条语句就是增加一条bindings然后赋给binding变量,可是这和激活idTCPServer有什么联系呢?IP地址和端口Port是赋给binding变量的,并没有赋给idTCPServer啊!!
难道binding和IdTCPServer.bindings有什么内在联系吗?
是不是Binding := IdTCPServer.Bindings.Add;后,Binding变量和IdTCPServer.Bindings就是同一个东西了?
var
Binding : TIdSocketHandle;
begin
...
for i := 0 to lbIPs.Count-1 do
if lbIPs.Checked then
begin
Binding := IdTCPServer.Bindings.Add;
Binding.IP := lbIPs.Items.Strings;
Binding.Port := StrToInt(edtPort.Text);
SL.append('Server bound to IP ' + Binding.IP + ' on port ' + edtPort.Text);
end;
IdTCPServer.Active := true;
result := IdTCPServer.Active;
fServerRunning := result;
lbProcesses.Items.AddStrings(SL);
lbProcesses.Items.Append('Server started');
...
end;
变量binding并不是idTCPserver的一部分。那么这
Binding := IdTCPServer.Bindings.Add;
Binding.IP := lbIPs.Items.Strings;
Binding.Port := StrToInt(edtPort.Text);
就不能把IP和port的值赋给idTCPServer啊?那这段话有什么用处?
Binding := IdTCPServer.Bindings.Add;
这条语句就是增加一条bindings然后赋给binding变量,可是这和激活idTCPServer有什么联系呢?IP地址和端口Port是赋给binding变量的,并没有赋给idTCPServer啊!!
难道binding和IdTCPServer.bindings有什么内在联系吗?
是不是Binding := IdTCPServer.Bindings.Add;后,Binding变量和IdTCPServer.Bindings就是同一个东西了?