简体   繁体   English

Delphi XE 7 Indy IRC检测到连接丢失

[英]Delphi XE 7 Indy IRC detect connection lost

All works good but sometimes after many hours connection can be lost. 一切正常,但有时几个小时后连接可能会丢失。 How i should detect that chat isnt workin anymore? 我应该如何检测聊天不再起作用? Should i use PING/PONG event to detect that? 我应该使用PING / PONG事件来检测吗? This happens very rare, but still can happen. 这种情况很少发生,但仍然可能发生。 Thanks for suggestions. 感谢您的建议。

Yes, the IRC PING and PONG commands should be used to improve connection stability. 是的,应该使用IRC PING和PONG命令来提高连接稳定性。


Server and client could send "empty" (no-op, heart-beat) messages to keep the connecion alive. 服务器和客户端可以发送“空”(无操作,心跳)消息以使连接保持活动状态。 If one party does not receive these messages anymore, the connection can be considered lost. 如果一方不再收到这些消息,则可以认为连接丢失。 The server then can simply close the connection, if he detects an unresponsive client. 如果服务器检测到客户端无响应,则服务器可以简单地关闭连接。 A client could display an error message and offer the user to connect again, or re-connect automatically. 客户端可能会显示错误消息,并为用户提供重新连接或自动重新连接的功能。

Adding no-op (heart-beat) messages alone will help to keep a connection stable, as some network components may chose to terminate connections after long time of inactivity. 仅添加无操作(心跳)消息将有助于保持连接稳定,因为某些网络组件可能会在长时间不活动后选择终止连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM