public final class SocketUtils extends Object
SecurityManager
to restrict SocketPermission
to their application. By asserting that these
operations are privileged, the operations can proceed even if some code in the calling chain lacks the appropriate
SocketPermission
.Modifier and Type | Method and 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(DatagramChannel networkChannel,
SocketAddress address) |
static void |
bind(SocketChannel socketChannel,
SocketAddress address) |
static void |
bind(Socket socket,
SocketAddress bindpoint) |
static boolean |
connect(SocketChannel socketChannel,
SocketAddress remoteAddress) |
static void |
connect(Socket socket,
SocketAddress remoteAddress,
int timeout) |
static byte[] |
hardwareAddressFromNetworkInterface(NetworkInterface intf) |
static SocketAddress |
localSocketAddress(ServerSocket socket) |
static InetAddress |
loopbackAddress() |
static InetSocketAddress |
socketAddress(String hostname,
int port) |
public static void connect(Socket socket, SocketAddress remoteAddress, int timeout) throws IOException
IOException
public static void bind(Socket socket, SocketAddress bindpoint) throws IOException
IOException
public static boolean connect(SocketChannel socketChannel, SocketAddress remoteAddress) throws IOException
IOException
public static void bind(SocketChannel socketChannel, SocketAddress address) throws IOException
IOException
public static SocketChannel accept(ServerSocketChannel serverSocketChannel) throws IOException
IOException
public static void bind(DatagramChannel networkChannel, SocketAddress address) throws IOException
IOException
public static SocketAddress localSocketAddress(ServerSocket socket)
public static InetAddress addressByName(String hostname) throws UnknownHostException
UnknownHostException
public static InetAddress[] allAddressesByName(String hostname) throws UnknownHostException
UnknownHostException
public static InetSocketAddress socketAddress(String hostname, int port)
public static Enumeration<InetAddress> addressesFromNetworkInterface(NetworkInterface intf)
public static InetAddress loopbackAddress()
public static byte[] hardwareAddressFromNetworkInterface(NetworkInterface intf) throws SocketException
SocketException
Copyright © 2008–2024 The Netty Project. All rights reserved.