public final class SocketUtils
extends java.lang.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
.限定符和类型 | 方法和说明 |
---|---|
static java.nio.channels.SocketChannel |
accept(java.nio.channels.ServerSocketChannel serverSocketChannel) |
static java.net.InetAddress |
addressByName(java.lang.String hostname) |
static java.util.Enumeration<java.net.InetAddress> |
addressesFromNetworkInterface(java.net.NetworkInterface intf) |
static java.net.InetAddress[] |
allAddressesByName(java.lang.String hostname) |
static void |
bind(java.nio.channels.DatagramChannel networkChannel,
java.net.SocketAddress address) |
static void |
bind(java.nio.channels.SocketChannel socketChannel,
java.net.SocketAddress address) |
static void |
bind(java.net.Socket socket,
java.net.SocketAddress bindpoint) |
static boolean |
connect(java.nio.channels.SocketChannel socketChannel,
java.net.SocketAddress remoteAddress) |
static void |
connect(java.net.Socket socket,
java.net.SocketAddress remoteAddress,
int timeout) |
static byte[] |
hardwareAddressFromNetworkInterface(java.net.NetworkInterface intf) |
static java.net.SocketAddress |
localSocketAddress(java.net.ServerSocket socket) |
static java.net.InetSocketAddress |
socketAddress(java.lang.String hostname,
int port) |
public static void connect(java.net.Socket socket, java.net.SocketAddress remoteAddress, int timeout) throws java.io.IOException
java.io.IOException
public static void bind(java.net.Socket socket, java.net.SocketAddress bindpoint) throws java.io.IOException
java.io.IOException
public static boolean connect(java.nio.channels.SocketChannel socketChannel, java.net.SocketAddress remoteAddress) throws java.io.IOException
java.io.IOException
public static void bind(java.nio.channels.SocketChannel socketChannel, java.net.SocketAddress address) throws java.io.IOException
java.io.IOException
public static java.nio.channels.SocketChannel accept(java.nio.channels.ServerSocketChannel serverSocketChannel) throws java.io.IOException
java.io.IOException
public static void bind(java.nio.channels.DatagramChannel networkChannel, java.net.SocketAddress address) throws java.io.IOException
java.io.IOException
public static java.net.SocketAddress localSocketAddress(java.net.ServerSocket socket)
public static java.net.InetAddress addressByName(java.lang.String hostname) throws java.net.UnknownHostException
java.net.UnknownHostException
public static java.net.InetAddress[] allAddressesByName(java.lang.String hostname) throws java.net.UnknownHostException
java.net.UnknownHostException
public static java.net.InetSocketAddress socketAddress(java.lang.String hostname, int port)
public static java.util.Enumeration<java.net.InetAddress> addressesFromNetworkInterface(java.net.NetworkInterface intf)
public static byte[] hardwareAddressFromNetworkInterface(java.net.NetworkInterface intf) throws java.net.SocketException
java.net.SocketException