- java.lang.Object
-
- io.netty5.util.internal.SocketUtils
-
public final class SocketUtils extends Object
Provides socket operations with privileges enabled. This is necessary for applications that use theSecurityManager
to restrictSocketPermission
to their application. By asserting that these operations are privileged, the operations can proceed even if some code in the calling chain lacks the appropriateSocketPermission
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SocketChannel
accept(ServerSocketChannel serverSocketChannel)
static InetAddress
addressByName(String hostname)
static Enumeration<InetAddress>
addressesFromNetworkInterface(NetworkInterface intf)
static InetAddress[]
allAddressesByName(String hostname)
static void
bind(Socket socket, SocketAddress bindpoint)
static void
bind(DatagramChannel networkChannel, SocketAddress address)
static void
bind(SocketChannel socketChannel, SocketAddress address)
static void
connect(Socket socket, SocketAddress remoteAddress, int timeout)
static boolean
connect(SocketChannel socketChannel, SocketAddress remoteAddress)
static byte[]
hardwareAddressFromNetworkInterface(NetworkInterface intf)
static SocketAddress
localSocketAddress(ServerSocket socket)
static InetAddress
loopbackAddress()
static InetSocketAddress
socketAddress(String hostname, int port)
-
-
-
Method Detail
-
connect
public static void connect(Socket socket, SocketAddress remoteAddress, int timeout) throws IOException
- Throws:
IOException
-
bind
public static void bind(Socket socket, SocketAddress bindpoint) throws IOException
- Throws:
IOException
-
connect
public static boolean connect(SocketChannel socketChannel, SocketAddress remoteAddress) throws IOException
- Throws:
IOException
-
bind
public static void bind(SocketChannel socketChannel, SocketAddress address) throws IOException
- Throws:
IOException
-
accept
public static SocketChannel accept(ServerSocketChannel serverSocketChannel) throws IOException
- Throws:
IOException
-
bind
public static void bind(DatagramChannel networkChannel, SocketAddress address) throws IOException
- Throws:
IOException
-
localSocketAddress
public static SocketAddress localSocketAddress(ServerSocket socket)
-
addressByName
public static InetAddress addressByName(String hostname) throws UnknownHostException
- Throws:
UnknownHostException
-
allAddressesByName
public static InetAddress[] allAddressesByName(String hostname) throws UnknownHostException
- Throws:
UnknownHostException
-
socketAddress
public static InetSocketAddress socketAddress(String hostname, int port)
-
addressesFromNetworkInterface
public static Enumeration<InetAddress> addressesFromNetworkInterface(NetworkInterface intf)
-
loopbackAddress
public static InetAddress loopbackAddress()
-
hardwareAddressFromNetworkInterface
public static byte[] hardwareAddressFromNetworkInterface(NetworkInterface intf) throws SocketException
- Throws:
SocketException
-
-