Package org.jivesoftware.openfire.net
Class SocketUtil
- java.lang.Object
-
- org.jivesoftware.openfire.net.SocketUtil
-
public class SocketUtil extends Object
Utility class to generate Socket instances.- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
-
Constructor Summary
Constructors Constructor Description SocketUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map.Entry<Socket,Boolean>
createSocketToXmppDomain(String xmppDomain, int port)
Creates a socket connection to an XMPP domain.
-
-
-
Method Detail
-
createSocketToXmppDomain
public static Map.Entry<Socket,Boolean> createSocketToXmppDomain(String xmppDomain, int port)
Creates a socket connection to an XMPP domain. This implementation uses DNS SRV records to find a list of remote hosts for the XMPP domain (as implemented byDNSUtil.resolveXMPPDomain(String, int)
. It then iteratively tries to create a socket connection to each of them, until one socket connection succeeds. Either the connected Socket instance is returned, or null if no connection could be established. Note that this method blocks while performing network IO. The timeout as defined byRemoteServerManager.getSocketTimeout()
is observed.- Parameters:
xmppDomain
- The XMPP domain to connect to.port
- The port to connect to when DNS resolution fails.- Returns:
- a Socket instance that is connected, or null.
- See Also:
DNSUtil.resolveXMPPDomain(String, int)
-
-