1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 14:02:06 +01:00

Added ability to get the local network address that connects to the server.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7525 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2007-03-15 02:53:01 +00:00 committed by matt
parent 553212405d
commit c7fc4734b8

View file

@ -34,6 +34,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.Socket;
import java.net.UnknownHostException;
import java.net.InetAddress;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@ -532,6 +533,19 @@ public class XMPPConnection {
return isUsingTLS();
}
/**
* Returns the local network address of the socket used to connect to the server, or
* <tt>null</tt> if not currently connected to the server.
*
* @return the local address for the socket used to connect to the server.
*/
public InetAddress getLocalNetworkAddress() {
if (socket == null || !socket.isConnected()) {
return null;
}
return socket.getLocalAddress();
}
/**
* Returns true if currently authenticated by successfully calling the login method.
*