public final class NetworkTools
extends java.lang.Object
| Modifier and Type | Method and Description | 
|---|---|
static javax.net.ssl.SSLSocketFactory | 
createSSLSocketFactory()
Creates and returns an SSLSocketFactory using an X509ExtendedTrustManager. 
 | 
static java.lang.String | 
getHostname()
Determines and returns hostname of the current machine. 
 | 
static java.net.InetAddress | 
getNetworkAddress()
Determines and returns the external  
InetAddress of the current machine
 by crawling trough the InetAdresses from NetworkInterface. | 
static java.net.InetAddress | 
getNetworkAddress(boolean onlyResolvableName)  | 
static long | 
ip2long(java.lang.String n)
Converts a given human readable ip-v4-address (i.e. 1.2.3.4/32) into an ip-address as long 
 | 
static boolean | 
isMyIpAddress(java.net.InetAddress addr)
Returns true, if the passed InetAddress is the caller's own InetAddress. 
 | 
static boolean | 
isPortAvailable(java.lang.String host,
               int port)
Returns true, if the given port on the given host is not listening. 
 | 
static java.lang.String | 
long2ip(long n)
Converts a given ip-v4-address in long (host) into a human readable ip-v4-address (i.e. 1.2.3.4/32) 
 | 
static java.lang.String | 
niceAddress(java.net.InetAddress ina,
           int port)
Returns a nicely formatted String for the passed InetAddress and port. 
 | 
static void | 
prepareSecureSocket(javax.net.ssl.SSLServerSocket s)
Prepares a passed SSLServerSocket for usage as secure transport, "secure" as defined by us
 (using only really secure protocols and cipher suites, that have not yet been hacked AFAWK). 
 | 
static void | 
prepareSecureSocket(javax.net.ssl.SSLSocket s)
Prepares a passed SSLSocket for usage as secure transport, "secure" as defined by us
 (using only really secure protocols and cipher suites, that have not yet been hacked AFAWK). 
 | 
public static javax.net.ssl.SSLSocketFactory createSSLSocketFactory()
public static java.lang.String niceAddress(java.net.InetAddress ina,
                                           int port)
public static java.lang.String long2ip(long n)
n - the ip-v4-address to convert as longpublic static long ip2long(java.lang.String n)
n - the human readable ip-v4-addresspublic static boolean isMyIpAddress(java.net.InetAddress addr)
public static java.net.InetAddress getNetworkAddress()
InetAddress of the current machine
 by crawling trough the InetAdresses from NetworkInterface.onlyResolvableName - forces to use only a by hostname resolvable adresspublic static java.net.InetAddress getNetworkAddress(boolean onlyResolvableName)
public static java.lang.String getHostname()
public static boolean isPortAvailable(java.lang.String host,
                                      int port)
public static void prepareSecureSocket(javax.net.ssl.SSLSocket s)
public static void prepareSecureSocket(javax.net.ssl.SSLServerSocket s)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.