public class PingManager extends Object
NOTE: The KeepAliveManager
already provides a keepalive functionality
for regularly pinging the server to keep the underlying transport connection
alive. This class is specifically intended to do manual pings of other
entities.
Modifier and Type | Method and Description |
---|---|
static PingManager |
getInstanceFor(Connection connection)
Retrieves a
PingManager for the specified Connection , creating one if it doesn't already
exist. |
boolean |
isPingSupported(String jid)
Query the specified entity to see if it supports the Ping protocol (XEP-0199)
|
boolean |
ping(String jid)
Same as calling
ping(String, long) with the defaultpacket reply
timeout. |
boolean |
ping(String jid,
long pingTimeout)
Pings the given jid.
|
boolean |
pingMyServer()
Pings the server.
|
public static PingManager getInstanceFor(Connection connection)
PingManager
for the specified Connection
, creating one if it doesn't already
exist.connection
- The connection the manager is attached to.public boolean ping(String jid, long pingTimeout)
Use isPingSupported(String)
to determine if XMPP Ping is supported
by the entity.
jid
- The id of the entity the ping is being sent topingTimeout
- The time to wait for a replypublic boolean ping(String jid)
ping(String, long)
with the defaultpacket reply
timeout.jid
- The id of the entity the ping is being sent topublic boolean isPingSupported(String jid) throws XMPPException
jid
- The id of the entity the query is being sent toXMPPException
- An XMPP related error occurred during the requestpublic boolean pingMyServer()
ping
with the XMPP domain.
Unlike the ping(String)
case, this method will return true even if
isPingSupported(String)
is false.
Copyright © 2003-2007 Jive Software.