You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Andrew Stitcher <as...@redhat.com> on 2017/01/04 15:51:26 UTC

Re: how to detect disconnection

On Mon, 2016-12-26 at 13:14 +0000, Pam wrote:
> Hello,
> I am using�qpid-proton-0.14.0 C++ client in an embedded environment
> (ARM device). I am connecting to AMQP broker, and sending/receiving
> messages without problem.
> I have one more requirement: When I am not able to send message
> because of network problems, I should send those messages later. To
> simulate this, after successfully connecting and starting to
> send/receive messages, I REMOVE ethernet network cable from device.
> However, neither of these overridden�proton::messaging_handler
> functions are called:
> on_transport_error, on_transport_close,
> �on_connection_close,�on_connection_error,�on_sender_close,�on_sender
> _error,�on_sender_detach,�on_receiver_close,�on_receiver_error,�on_re
> ceiver_detach,�on_error
> 
> As a result, I am not able to detect network problems. How could I do
> it?Thanks in advance.

The way that TCP works you would not expect any immediate notification
if you disconnect the ethernet.

By default, TCP connections can survive very long periods without any
packets being sent, and no packets are sent unless messages are being
sent.

So if you disconnect and then try to send eventually you should get
some notification at the socket level that the connection has errored,
but it may well take several minutes (the figure of 2 minutes comes to
mind from somewhere).

If you want more immediate notification you should use the idle
timeout, which will force heartbeat packets to be sent and so will
detect a broken connection within the timeout period.

In that case you would expect to receive a on_transport_error (followed
by on_transport_close).

Andrew


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org