Indy - find out when the modem sent the RESET flag [RST]

I noticed that I get an EIdSocketError with LastError = 10054 or 10053 when the device I'm talking to sends a RESET response. Which makes sense considering 10054 is a RESET By Peer connection.

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

One scenario I ran into was the modem responding with a RESET response after I connected (Indy didn't throw an exception), so from my point of view the connection changed. Then I tried to write to the socket (i.e. Send a packet using TidTCPClient) and it got error 10054.

Is it possible to view this RESET response at all?

thank

+3


source to share


1 answer


Usage try..except

is the right way. Indy reports exceptions. Even "The connection is closed gracefully" is an exception in Indy's eyes.



+2


source







All Articles