- 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 theSecurityManagerto restrictSocketPermissionto 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 SocketChannelaccept(ServerSocketChannel serverSocketChannel)static InetAddressaddressByName(String hostname)static Enumeration<InetAddress>addressesFromNetworkInterface(NetworkInterface intf)static InetAddress[]allAddressesByName(String hostname)static voidbind(Socket socket, SocketAddress bindpoint)static voidbind(DatagramChannel networkChannel, SocketAddress address)static voidbind(SocketChannel socketChannel, SocketAddress address)static voidconnect(Socket socket, SocketAddress remoteAddress, int timeout)static booleanconnect(SocketChannel socketChannel, SocketAddress remoteAddress)static byte[]hardwareAddressFromNetworkInterface(NetworkInterface intf)static SocketAddresslocalSocketAddress(ServerSocket socket)static InetAddressloopbackAddress()static InetSocketAddresssocketAddress(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
-
-