如何完全断开TCPClient? (印地)
当我的 Tcpclient 工作时,使用以下代码:
TCPClient.Disconnect;
TCPClient.Connect;
我仍然收到“引发异常类 EIdAlreadyConnected 并带有消息“已连接”。” 错误(而之前已断开连接)。
那么,我怎样才能完全断开它呢?
谢谢
When my Tcpclient is working , with this code :
TCPClient.Disconnect;
TCPClient.Connect;
I get "raised exception class EIdAlreadyConnected with message 'Already connected.'." error still (whereas , it has been disconnected before) .
So , how can i disconnect it totally ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 indy 10 中使用时,您必须确保输入缓冲区为空。
using at indy 10 you must sure inputbuffer is empty.
你说它已断开连接,但你只给出了断开连接的命令。
网络流量需要时间,并且您可能在真正断开连接之前重新连接。
也许您需要监视某些连接状态或事件以等待真正断开连接。
...或者尝试处理异常并忽略它,使用 try..except
You say it is disconnected, but you only gave the command to disconnect.
Network traffic takes time, and probably you reconnected before you were really disconnected.
Probably you need to monitor some connection state or event to wait till you really are disconnected.
... or try to process the exception and ignore it, using try..except