[jdev] XEP-0199 (XMPP Ping) to test reliability

Dave Cridland dave at cridland.net
Wed Jan 23 08:10:25 CST 2008

On Wed Jan 23 13:43:15 2008, Tomasz Sterna wrote:
> On Śr, 2008-01-23 at 13:32 +0100, Yann Leboulanger wrote:
> > Ok, XEP-0199 will do that then ;)
> I've been trying to explain that whitespace keepalive is enough.
> It seems that I failed...

I was going to send a post on why it is, when it isn't, etc. So maybe  
I should...

There are, roughly, three kinds of NAT.

1) Linux boxes, and similar almost reasonable NATs.

These will simply maintain dormant connections. I forget how many a  
typical Linux box with a few meg can hold, but it's lots.

You don't need anything here.

2) Bad NATs.

These will sever dormant TCP connections silently, but they will send  
back RST packets on further attempts. (Some even reestablish the TCP  
session, rather weirdly, although this often fails because they've  
already sent an RST packet back to the server, in which case the RST  
packet you get is from the server, rather than synthetic).

Whitespace is all you need here, to keep the session alive and detect  
when it's severed.

3) Piss poor NATs.

These are the ones that sever your connection, and then throw away  
anything else they see.

To handle these, whitespace will keep the session up, but if for some  
reason this fails, then the sympton will be that nothing comes back  
down the line.

XEP-0198 is one option here, as is XEP-0199. But there's no need to  
send XEP-0199 every minute - instead, use it when you suspect the  
link is down. This might be because of long term inactivity, and/or  
because you're sending (real) traffic and getting no response.  
(Obviously <iq/> stanzas emit a response, but normally people answer  
<message/> stanzas too.).

Dave Cridland - mailto:dave at cridland.net - xmpp:dwd at jabber.org
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade

More information about the JDev mailing list