|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.util.NetUtils
public class NetUtils
This utility class contains socket helper functions.
| Method Summary | |
|---|---|
static java.net.ServerSocket |
closeSilently(java.net.ServerSocket socket)
Close a server socket and ignore any exceptions. |
static java.net.Socket |
createLoopbackSocket(int port,
boolean ssl)
Create a loopback socket (a socket that is connected to localhost) on this port. |
static java.net.ServerSocket |
createServerSocket(int port,
boolean ssl)
Create a server socket. |
static java.net.Socket |
createSocket(java.net.InetAddress address,
int port,
boolean ssl)
Create a client socket that is connected to the given address and port. |
static java.net.Socket |
createSocket(java.lang.String server,
int defaultPort,
boolean ssl)
Create a client socket that is connected to the given address and port. |
static java.lang.String |
getLocalAddress()
Get the local host address as a string. |
static boolean |
isLocalAddress(java.net.Socket socket)
Check if a socket is connected to a local address. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.net.Socket createLoopbackSocket(int port,
boolean ssl)
throws java.io.IOException
port - the portssl - if SSL should be used
java.io.IOException
public static java.net.Socket createSocket(java.lang.String server,
int defaultPort,
boolean ssl)
throws java.io.IOException
server - to connect to (including an optional port)defaultPort - the default port (if not specified in the server
address)ssl - if SSL should be used
java.io.IOException
public static java.net.Socket createSocket(java.net.InetAddress address,
int port,
boolean ssl)
throws java.io.IOException
address - the address to connect toport - the portssl - if SSL should be used
java.io.IOException
public static java.net.ServerSocket createServerSocket(int port,
boolean ssl)
port - the port to listen onssl - if SSL should be used
public static boolean isLocalAddress(java.net.Socket socket)
throws java.net.UnknownHostException
socket - the socket
java.net.UnknownHostExceptionpublic static java.net.ServerSocket closeSilently(java.net.ServerSocket socket)
socket - the socket
public static java.lang.String getLocalAddress()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||