LinuxSocket Class — netty Architecture
Architecture documentation for the LinuxSocket class in LinuxSocket.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b60ae45e_66b1_2a0f_625b_421b64bfcb66["LinuxSocket"] 89850278_353b_3d4c_ff54_7a0ff00a5fad["LinuxSocket.java"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|defined in| 89850278_353b_3d4c_ff54_7a0ff00a5fad 895a1288_3fdd_caad_d71e_1e4875c6c0c2["LinuxSocket()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 895a1288_3fdd_caad_d71e_1e4875c6c0c2 0abb6898_326a_e624_5703_674e3b2f4aae["SocketProtocolFamily()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 0abb6898_326a_e624_5703_674e3b2f4aae 6fbc893f_8236_8391_e752_209fd6e427e6["markClosed()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 6fbc893f_8236_8391_e752_209fd6e427e6 c7ae434c_ab7e_2a34_ea5b_d0308f907ed7["setTimeToLive()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| c7ae434c_ab7e_2a34_ea5b_d0308f907ed7 0e121858_6d09_a7ae_8a93_1f4bde13ae3a["setInterface()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 0e121858_6d09_a7ae_8a93_1f4bde13ae3a a2dd8161_7d60_315b_8bb9_31aa1d70c12a["setNetworkInterface()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| a2dd8161_7d60_315b_8bb9_31aa1d70c12a 1417095d_327c_9ebc_c8e0_d533a9f2f6f7["InetAddress()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 1417095d_327c_9ebc_c8e0_d533a9f2f6f7 40fdcf11_381d_d2b0_958b_a861c32bd317["NetworkInterface()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 40fdcf11_381d_d2b0_958b_a861c32bd317 3d72cfee_4391_8a07_bb1f_af17b0113d23["joinGroup()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 3d72cfee_4391_8a07_bb1f_af17b0113d23 6ab70505_2fef_4120_bafe_110bee041290["leaveGroup()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 6ab70505_2fef_4120_bafe_110bee041290 e153647a_353a_1569_6039_2670f6c0a5c4["interfaceIndex()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| e153647a_353a_1569_6039_2670f6c0a5c4 25d9446a_a87d_6e11_9d8f_449f59f36f54["setTcpDeferAccept()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 25d9446a_a87d_6e11_9d8f_449f59f36f54 2c425d87_6501_96ed_bd5d_b2dfcbbae9db["setTcpQuickAck()"] b60ae45e_66b1_2a0f_625b_421b64bfcb66 -->|method| 2c425d87_6501_96ed_bd5d_b2dfcbbae9db
Relationship Graph
Source Code
transport-classes-io_uring/src/main/java/io/netty/channel/uring/LinuxSocket.java lines 35–391
final class LinuxSocket extends Socket {
static final InetAddress INET6_ANY = unsafeInetAddrByName("::");
private static final InetAddress INET_ANY = unsafeInetAddrByName("0.0.0.0");
private static final long MAX_UINT32_T = 0xFFFFFFFFL;
LinuxSocket(int fd) {
super(fd);
}
SocketProtocolFamily family() {
return ipv6 ? SocketProtocolFamily.INET6 : SocketProtocolFamily.INET;
}
@Override
public boolean markClosed() {
return super.markClosed();
}
void setTimeToLive(int ttl) throws IOException {
setTimeToLive(intValue(), ttl);
}
void setInterface(InetAddress address) throws IOException {
final NativeInetAddress a = NativeInetAddress.newInstance(address);
setInterface(intValue(), ipv6, a.address(), a.scopeId(), interfaceIndex(address));
}
void setNetworkInterface(NetworkInterface netInterface) throws IOException {
InetAddress address = deriveInetAddress(netInterface, family() == SocketProtocolFamily.INET6);
if (address.equals(family() == SocketProtocolFamily.INET ? INET_ANY : INET6_ANY)) {
throw new IOException("NetworkInterface does not support " + family());
}
final NativeInetAddress nativeAddress = NativeInetAddress.newInstance(address);
setInterface(intValue(), ipv6, nativeAddress.address(), nativeAddress.scopeId(), interfaceIndex(netInterface));
}
InetAddress getInterface() throws IOException {
NetworkInterface inf = getNetworkInterface();
if (inf != null) {
Enumeration<InetAddress> addresses = SocketUtils.addressesFromNetworkInterface(inf);
if (addresses.hasMoreElements()) {
return addresses.nextElement();
}
}
return null;
}
NetworkInterface getNetworkInterface() throws IOException {
int ret = getInterface(intValue(), ipv6);
if (ipv6) {
return NetworkInterface.getByIndex(ret);
}
InetAddress address = inetAddress(ret);
return address != null ? NetworkInterface.getByInetAddress(address) : null;
}
private static InetAddress inetAddress(int value) {
byte[] var1 = {
(byte) (value >>> 24 & 255),
(byte) (value >>> 16 & 255),
(byte) (value >>> 8 & 255),
(byte) (value & 255)
};
try {
return InetAddress.getByAddress(var1);
} catch (UnknownHostException ignore) {
return null;
}
}
void joinGroup(InetAddress group, NetworkInterface netInterface, InetAddress source) throws IOException {
final NativeInetAddress g = NativeInetAddress.newInstance(group);
final boolean isIpv6 = group instanceof Inet6Address;
final NativeInetAddress i = NativeInetAddress.newInstance(deriveInetAddress(netInterface, isIpv6));
if (source != null) {
final NativeInetAddress s = NativeInetAddress.newInstance(source);
joinSsmGroup(intValue(), ipv6, g.address(), i.address(),
g.scopeId(), interfaceIndex(netInterface), s.address());
} else {
joinGroup(intValue(), ipv6, g.address(), i.address(), g.scopeId(), interfaceIndex(netInterface));
Source
Frequently Asked Questions
What is the LinuxSocket class?
LinuxSocket is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/LinuxSocket.java.
Where is LinuxSocket defined?
LinuxSocket is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/LinuxSocket.java at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free