为什么连成功后Timer1控件就不在循环了
- Delphi(Pascal) code
procedure TForm1.Timer1Timer(Sender: TObject);beginIdTCPClient1.Host:=192.168.1.88;IdTCPClient1.Port:=5555; if not IdTCPClient1.Connected then begin try IdTCPClient1.Connect; IdTCPClient1.Writeln(ip_w); StatusBar1.Panels.Items[0].Text:='连接成功!'; except StatusBar1.Panels.Items[0].Text:='连接错误!'; exit; end; end;end;
为什么连成功后Timer1控件就不在循环了
[解决办法]
if not IdTCPClient1.Connected then begin
你的这条语句已经跳过下面的过程了。
[解决办法]
楼上的回答正确,楼主若不相信Timer1Timer事件还在执行,可以在if not IdTCPClient1.Connected then begin语句设置断点,它一定会运行到这句停下。