Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Client be disconnected when keepAliveInterval more than 10 secs

Thanks Dave, that was quick. I timed the timeout at a constant 2 minutes 38 seconds before adding the reconnect.
I'll have a look at the exception and will file an issue.

best regards,

René.

On 25 okt. 2012, at 14:29, Dave Locke <locke@xxxxxxxxxx> wrote:

The Paho Java Client should keep the connection alive by sending pings every keepalive interval if no other messages flow.  If the network is in good shape and the sever is running correctly it should stay connected forever.  Is Mosquitto putting out an error stating it has killed the client as it has not received any packets from the client?  If that is the case it could be a bug in the Java client.  It is always 5 mins that the client is disconnected?

Can you raise a bug on bugzilla against paho here with full details?   Paho bugzilla site can be found here: https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&product=Paho&list_id=3330457

Per Rene it is a good idea to code the connectionLost call back to handle the case when a client disconnects abnormally e.g. blip in the network....

Dave
 



From:        René Jansen <rvjansen@xxxxxxxxx>
To:        General development discussions for paho project <paho-dev@xxxxxxxxxxx>,
Date:        25/10/2012 13:06
Subject:        Re: [paho-dev] Client be disconnected when keepAliveInterval more        than 10 secs
Sent by:        paho-dev-bounces@xxxxxxxxxxx




Hi Charles,

I just reconnect when the connectionLost event comes in:


 method connectionLost(t=Throwable)
   do
   connectAndSubscribe()
   catch mqx=MqttException
     log(mqx.getMessage())
   end


(this is NetRexx source but you get the picture).


best regards,

René Jansen.


On 25 okt. 2012, at 13:01, Charles Wang | 王晨 <kitta4587@xxxxxxxxx> wrote:

> I tried Mosquitto and ActiveMQ, the code is simple:
>
>        MqttClient client = new MqttClient("tcp://10.18.93.54:1883", "charles_subscribe");
>        MqttConnectOptions opts = new MqttConnectOptions();
>        opts.setKeepAliveInterval(10);
>        opts.setCleanSession(true);
>
>        client.setCallback(this);
>        client.connect(opts);
>        client.subscribe(topic);
>
>        try {
>            System.in.read();
>        } catch (IOException e) {
>            //If we can't read we'll just exit
>        }
>
>        // Disconnect the client
>        client.disconnect();
>
> When keepAliveInterval more than 10 secs, the server will kill the connection after about 5 mins.
> But the Mosquitto library for C is worked.
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
>
http://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/paho-dev


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top