Re: check connection status
From: Marc <mbalcells@xxxxxxxxx>
Date: Thu, 19 Nov 2009 20:36:48 +0100 (CET)
Thank's Donk, when I wrote my last message I wasn't really aware of the
extent of my problem, now I think I have a better idea and solution!!
hopefully.

My problem is that I'm using a non-blocking connection like in the discotest
example, so the main program cicle is driven by this connection which is
pretty handy as I can set all kinds of handlers and forget about it, the bad
part is that when I lose network connection, the program doesn't realize its
not connected to the server since any of the handlers has not received any
warning (obviously).

If I use a blocking connection, as soon as I get the connection, the program
has control again which is good and bad since I have to change everything
and ask for incomming messages every once in a while.

What I've done in the meanwhile is keep the initial non-blocking connection
and an extra function which tries a new connection with the same JID.
So I have one big non-blocking connection keeping it all toghether and a
quick blocking connection with the same JID to check that everything is
fine, if it fails to connect I don't send the message and since I already
had a thread sending whitespace pings every minute, I use this to know when
the connection is back and send stored messages.

This is working for me right now, if anybody has a better idea...




On Thu, Nov 19, 2009 at 7:56 PM, donk <discdonker@xxxxxxxxx> wrote:

>
> On Wed, Nov 18, 2009 at 12:36 PM, Marc <mbalcells@xxxxxxxxx> wrote:
> *snip*
> >
> > Is there any effective way to check if a server connection is still
> > available prior to sending a message? btw I'm using simple send(message)
> > without a messageSession handler.
> >
>
> Greetings,
>
> Google search turns up this thread that might be of help:
>
> http://camaya.net/glooxlist/dev/msg00566.html
>
> If there's any way you can use gloox 1.0 instead of 0.9.9.12 then you
> may be able to use the XMPP ping extension.
>
> Google search for "XMPP ping" yields:
>
> http://xmpp.org/extensions/xep-0199.html
>
> Google search for "gloox xep-0199" digs down to the following:
>
> http://camaya.net/api/gloox-1.0/classgloox_1_1ClientBase.html#a38
>
> HTH,
> "Donk"
>
>
>
> --
> gloox-dev mailing list
> to unsubscribe:
> send a message with subject 'unsubscribe gloox-dev' to
> minimalist@xxxxxxxxxx
>



-- 
Marc.