请教 Indy10 的 IdTCPServer 停止时 造成程序僵死无反应。
Indy 10 的 IdTCPServer 监听端口后,当客户端连接上后
直接关闭程序 IdTCPServer.Active := false; 时发现程序就僵死了。
窗体关闭事件代码如下:
with IdCollectServer.Contexts.LockList do
try
for I :=Count - 1 downto 0 do
try
if TIdContext(Items[i]).Connection.Connected then
TIdContext(Items[i]).Connection.Disconnect;
except
end;
finally
IdCollectServer.Contexts.UnlockList;
end;
IdCollectServer.Active := false;