[JDEV] Detecting client/server disconnect?

Oliver Jones oj at world.std.com
Fri Apr 6 17:40:39 CDT 2001

At 09:58 AM 4/6/01 -0700, Jens wrote:
>How does the Jabber protocol deal with the unexpected disconnection of a 
>client or server? I'm referring not to a process crash, but to unlikely 
>situations like kernel panic or power failure, as well as more likely ones 
>like network failure (modem hangs up, PacBell's DSL network horks, laptop 
>moves out of 802.11 range, baby yanks out Ethernet plug, etc.)

Far as I can tell, this is a problem with Jabber at the architecture 
level.  A very common source of this kind of disconnect is loss of the 
"flow" through a NAT (ipmasq) box interfacing an office LAN to the public 

Winjab works around this problem.  It sends, once a minute, the five byte 
no-op message
    space space tab space space
to the server.  This keeps the flow open.  In xml terms, this message is 
formally a noop; very cool.

We got into a jam here because a custom client I and my colleagues 
developed didn't send this message.  I fixed this without requiring updates 
of the client in the field by hacking jpolld to send the keepalive message 
from the server to the client.  Works great.

>Some other presence protocols solve this by requiring the client to send a 
>"noop" or "ping" command every few minutes, which the server must respond to.

Well, Winjab has the keepalive message, but I don't think the jabber 
session-layer architecture says you HAVE to have it.  (Correct me if I'm 
wrong, Jabber mavens!)

I think the session-layer architecture SHOULD require keepalive. For one 
thing, on a highly scaled-up system the connection ports are a scarce 
resource.  A keepalive message in the architecture would allow a server to 
free up ports for clients that had gone out to lunch in the ways you described.

Ollie Jones

More information about the JDev mailing list