mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +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:
parent
553212405d
commit
c7fc4734b8
1 changed files with 14 additions and 0 deletions
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue