Indy - Know when modem has sent a RESET [RST] flag

醉酒当歌 提交于 2019-12-13 13:45:12

问题


I have noticed that I receive an EIdSocketError with LastError = 10054 or 10053 when the device I'm talking to sends a RESET response. Which makes sense, given 10054 is Connection Reset By Peer.

So is there anything I can check in Indy to determine if this has ocurred rather than wrapping my code in try/except block and looking for 10054 or 10053 error codes?

One scenario I encountered was the modem replied with a RESET reply after I connected (Indy didn't raise an exception) so from my point of view the connection succeeded. I then attempted to write to the socket (ie send a packet using TidTCPClient) and the 10054 error was raised.

Is it possible to see this RESET reply at all?

Thanks


回答1:


Using try..except is the right way. Indy communicates throught exceptions. Even 'Connection closed gracefully' is an exception in Indy's eyes.



来源:https://stackoverflow.com/questions/9800165/indy-know-when-modem-has-sent-a-reset-rst-flag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!