[JDEV] How to detect server is down

Jens Alfke jens at mooseyard.com
Mon Apr 16 11:52:37 CDT 2001


On Monday, April 16, 2001, at 01:03 AM, Glenn MacGregor wrote:

> You can use the echo.  Send a message like <message
> to='server/echo'><body>Echo</body></message>

That's sort of a heavyweight way to do it. When I asked the same 
question last week, the most elegant solution was to simply send a 
newline to the server. If no TCP acknowlegement is received, your 
network stack will tell you that the connection has closed.

Alternatively you can enable TCP keepalive mode on your socket, but 
setting the time interval below the default 2 hours is a relatively new 
feature and may not be supported on your system.

—Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 848 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/20010416/c242d59e/attachment-0002.bin>


More information about the JDev mailing list