SocketUtils Class — netty Architecture
Architecture documentation for the SocketUtils class in SocketUtils.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD be85935f_8b01_e8ee_e605_a1107ff9f20b["SocketUtils"] c885357c_1c37_6824_932c_7438089cbba5["SocketUtils.java"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|defined in| c885357c_1c37_6824_932c_7438089cbba5 01365944_0781_258f_9b83_4bc1320f7df4["SocketUtils()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 01365944_0781_258f_9b83_4bc1320f7df4 98b08588_cbd3_49ce_3bf4_695aa1541bff["empty()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 98b08588_cbd3_49ce_3bf4_695aa1541bff 0fe2f92c_9f55_7188_021c_c9e1c492cb7a["connect()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 0fe2f92c_9f55_7188_021c_c9e1c492cb7a 3010be84_cc50_c372_296c_1daccb3b0e16["bind()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 3010be84_cc50_c372_296c_1daccb3b0e16 e777642f_56c7_1a5d_abdf_3c8278933ef2["SocketChannel()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| e777642f_56c7_1a5d_abdf_3c8278933ef2 63b7ae04_e253_3967_63ab_9ceb10ffdbd6["SocketAddress()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 63b7ae04_e253_3967_63ab_9ceb10ffdbd6 1243e019_a86a_e1a9_f8c1_8ee8df87bded["InetAddress()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 1243e019_a86a_e1a9_f8c1_8ee8df87bded 78e6daa9_4ac1_c532_0360_7bf9500aff8c["allAddressesByName()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 78e6daa9_4ac1_c532_0360_7bf9500aff8c d95ef88b_63a7_85a6_b79c_f26f06981332["InetSocketAddress()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| d95ef88b_63a7_85a6_b79c_f26f06981332 6610bda8_3d4a_2dca_7d80_e7a45d0ba855["addressesFromNetworkInterface()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 6610bda8_3d4a_2dca_7d80_e7a45d0ba855 6fc24333_7795_7aeb_f537_f172589f460d["hardwareAddressFromNetworkInterface()"] be85935f_8b01_e8ee_e605_a1107ff9f20b -->|method| 6fc24333_7795_7aeb_f537_f172589f460d
Relationship Graph
Source Code
common/src/main/java/io/netty/util/internal/SocketUtils.java lines 44–222
public final class SocketUtils {
private static final Enumeration<Object> EMPTY = Collections.enumeration(Collections.emptyList());
private SocketUtils() {
}
@SuppressWarnings("unchecked")
private static <T> Enumeration<T> empty() {
return (Enumeration<T>) EMPTY;
}
public static void connect(final Socket socket, final SocketAddress remoteAddress, final int timeout)
throws IOException {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
socket.connect(remoteAddress, timeout);
return null;
}
});
} catch (PrivilegedActionException e) {
throw (IOException) e.getCause();
}
}
public static void bind(final Socket socket, final SocketAddress bindpoint) throws IOException {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
socket.bind(bindpoint);
return null;
}
});
} catch (PrivilegedActionException e) {
throw (IOException) e.getCause();
}
}
public static boolean connect(final SocketChannel socketChannel, final SocketAddress remoteAddress)
throws IOException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
@Override
public Boolean run() throws IOException {
return socketChannel.connect(remoteAddress);
}
});
} catch (PrivilegedActionException e) {
throw (IOException) e.getCause();
}
}
public static void bind(final SocketChannel socketChannel, final SocketAddress address) throws IOException {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
socketChannel.bind(address);
return null;
}
});
} catch (PrivilegedActionException e) {
throw (IOException) e.getCause();
}
}
public static SocketChannel accept(final ServerSocketChannel serverSocketChannel) throws IOException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<SocketChannel>() {
@Override
public SocketChannel run() throws IOException {
return serverSocketChannel.accept();
}
});
} catch (PrivilegedActionException e) {
throw (IOException) e.getCause();
}
}
Source
Frequently Asked Questions
What is the SocketUtils class?
SocketUtils is a class in the netty codebase, defined in common/src/main/java/io/netty/util/internal/SocketUtils.java.
Where is SocketUtils defined?
SocketUtils is defined in common/src/main/java/io/netty/util/internal/SocketUtils.java at line 44.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free