public final class Networking extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
IP_REGEX
Regex to match an IP Address.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
getCompanionPort(int port)
Return the companion port for the specified one.
|
static int |
getCompanionPort(int port,
int rounds)
Return the companion port for the specified one.
|
static String |
getIpAddress(String host)
Get the accessible IP Address for the
host. |
static int |
getOpenPort()
Get an open port on the local machine in the port range between
and .
|
static boolean |
isLocalHost(String host)
Return
true if the host belongs to the local machine. |
public static final String IP_REGEX
public static int getCompanionPort(int port)
port.port - public static int getCompanionPort(int port,
int rounds)
port.port - rounds - public static String getIpAddress(String host)
host.host - public static int getOpenPort()
public static boolean isLocalHost(String host)
true if the host belongs to the local machine.host - true if the host is local