Package io.netty.channel.unix
Class Socket
java.lang.Object
io.netty.channel.unix.FileDescriptor
io.netty.channel.unix.Socket
- Direct Known Subclasses:
BsdSocket
,LinuxSocket
Provides a JNI bridge to native socket operations.
Internal usage only!
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
private static boolean
static final int
Deprecated.Fields inherited from class io.netty.channel.unix.FileDescriptor
fd, state
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
accept
(byte[] addr) private static int
accept
(int fd, byte[] addr) private static int
bind
(int fd, boolean ipv6, byte[] address, int scopeId, int port) final void
bind
(SocketAddress socketAddress) private static int
bindDomainSocket
(int fd, byte[] path) private static int
connect
(int fd, boolean ipv6, byte[] address, int scopeId, int port) final boolean
connect
(SocketAddress socketAddress) private static int
connectDomainSocket
(int fd, byte[] path) final void
private static int
disconnect
(int fd, boolean ipv6) final boolean
private static int
finishConnect
(int fd) int
getIntOpt
(int level, int optname) private static int
getIntOpt
(int fd, int level, int optname) void
getRawOpt
(int level, int optname, ByteBuffer out) private static void
getRawOptAddress
(int fd, int level, int optname, long outMemoryAddress, int length) private static void
getRawOptArray
(int fd, int level, int optname, byte[] out, int offset, int length) final int
private static int
getReceiveBufferSize
(int fd) final int
private static int
getSendBufferSize
(int fd) final int
private static int
getSoError
(int fd) final int
private static int
getSoLinger
(int fd) final int
private static int
getTrafficClass
(int fd, boolean ipv6) static void
final boolean
private static int
isBroadcast
(int fd) final boolean
private static boolean
isIPv6
(int fd) static boolean
private static boolean
isIPv6Preferred0
(boolean ipv4Preferred) final boolean
private static int
isKeepAlive
(int fd) final boolean
final boolean
private static int
isReuseAddress
(int fd) final boolean
private static int
isReusePort
(int fd) final boolean
final boolean
private static int
isTcpNoDelay
(int fd) final void
listen
(int backlog) private static int
listen
(int fd, int backlog) final InetSocketAddress
private static byte[]
localAddress
(int fd) final DomainSocketAddress
private static byte[]
localDomainSocketAddress
(int fd) private static int
static Socket
protected static int
protected static int
newSocketDgram0
(boolean ipv6) protected static int
private static int
newSocketDgramFd
(boolean ipv6) static Socket
protected static int
static Socket
protected static int
private static int
private static int
static Socket
protected static int
protected static int
newSocketStream0
(boolean ipv6) protected static int
newSocketStream0
(InternetProtocolFamily protocol) private static int
newSocketStreamFd
(boolean ipv6) private static int
recv
(int fd, ByteBuffer buf, int pos, int limit) int
recv
(ByteBuffer buf, int pos, int limit) private static int
recvAddress
(int fd, long address, int pos, int limit) int
recvAddress
(long address, int pos, int limit) final int
recvFd()
private static int
recvFd
(int fd) private static DatagramSocketAddress
recvFrom
(int fd, ByteBuffer buf, int pos, int limit) final DatagramSocketAddress
recvFrom
(ByteBuffer buf, int pos, int limit) private static DatagramSocketAddress
recvFromAddress
(int fd, long memoryAddress, int pos, int limit) final DatagramSocketAddress
recvFromAddress
(long memoryAddress, int pos, int limit) private static DomainDatagramSocketAddress
recvFromAddressDomainSocket
(int fd, long memoryAddress, int pos, int limit) recvFromAddressDomainSocket
(long memoryAddress, int pos, int limit) private static DomainDatagramSocketAddress
recvFromDomainSocket
(int fd, ByteBuffer buf, int pos, int limit) recvFromDomainSocket
(ByteBuffer buf, int pos, int limit) final InetSocketAddress
private static byte[]
remoteAddress
(int fd) final DomainSocketAddress
private static byte[]
remoteDomainSocketAddress
(int fd) private static int
send
(int fd, ByteBuffer buf, int pos, int limit) int
send
(ByteBuffer buf, int pos, int limit) private static int
sendAddress
(int fd, long address, int pos, int limit) int
sendAddress
(long address, int pos, int limit) final int
sendFd
(int fdToSend) private static int
sendFd
(int socketFd, int fd) private static int
sendTo
(int fd, boolean ipv6, ByteBuffer buf, int pos, int limit, byte[] address, int scopeId, int port, int flags) final int
sendTo
(ByteBuffer buf, int pos, int limit, InetAddress addr, int port) final int
sendTo
(ByteBuffer buf, int pos, int limit, InetAddress addr, int port, boolean fastOpen) private static int
sendToAddress
(int fd, boolean ipv6, long memoryAddress, int pos, int limit, byte[] address, int scopeId, int port, int flags) final int
sendToAddress
(long memoryAddress, int pos, int limit, InetAddress addr, int port) final int
sendToAddress
(long memoryAddress, int pos, int limit, InetAddress addr, int port, boolean fastOpen) private static int
sendToAddressDomainSocket
(int fd, long memoryAddress, int pos, int limit, byte[] path) final int
sendToAddressDomainSocket
(long memoryAddress, int pos, int limit, byte[] path) private static int
sendToAddresses
(int fd, boolean ipv6, long memoryAddress, int length, byte[] address, int scopeId, int port, int flags) final int
sendToAddresses
(long memoryAddress, int length, InetAddress addr, int port) final int
sendToAddresses
(long memoryAddress, int length, InetAddress addr, int port, boolean fastOpen) private static int
sendToAddressesDomainSocket
(int fd, long memoryAddress, int length, byte[] path) final int
sendToAddressesDomainSocket
(long memoryAddress, int length, byte[] path) private static int
sendToDomainSocket
(int fd, ByteBuffer buf, int pos, int limit, byte[] path) final int
sendToDomainSocket
(ByteBuffer buf, int pos, int limit, byte[] path) final void
setBroadcast
(boolean broadcast) private static void
setBroadcast
(int fd, int broadcast) void
setIntOpt
(int level, int optname, int optvalue) private static void
setIntOpt
(int fd, int level, int optname, int optvalue) final void
setKeepAlive
(boolean keepAlive) private static void
setKeepAlive
(int fd, int keepAlive) void
setRawOpt
(int level, int optname, ByteBuffer optvalue) private static void
setRawOptAddress
(int fd, int level, int optname, long optvalueMemoryAddress, int length) private static void
setRawOptArray
(int fd, int level, int optname, byte[] optvalue, int offset, int length) final void
setReceiveBufferSize
(int receiveBufferSize) private static void
setReceiveBufferSize
(int fd, int receiveBufferSize) final void
setReuseAddress
(boolean reuseAddress) private static void
setReuseAddress
(int fd, int reuseAddress) final void
setReusePort
(boolean reusePort) private static void
setReusePort
(int fd, int reuseAddress) final void
setSendBufferSize
(int sendBufferSize) private static void
setSendBufferSize
(int fd, int sendBufferSize) final void
setSoLinger
(int soLinger) private static void
setSoLinger
(int fd, int soLinger) final void
setTcpNoDelay
(boolean tcpNoDelay) private static void
setTcpNoDelay
(int fd, int tcpNoDelay) final void
setTrafficClass
(int trafficClass) private static void
setTrafficClass
(int fd, boolean ipv6, int trafficClass) static boolean
shouldUseIpv6
(InternetProtocolFamily family) final void
shutdown()
final void
shutdown
(boolean read, boolean write) private static int
shutdown
(int fd, boolean read, boolean write) toString()
protected static boolean
useIpv6
(Socket socket, InetAddress address) Returnstrue
if the given socket and address combination should use IPv6 internally,false
otherwise.private boolean
useIpv6
(InetAddress address) Returnstrue
if we should use IPv6 internally,false
otherwise.Methods inherited from class io.netty.channel.unix.FileDescriptor
casState, close, equals, from, from, hashCode, inputShutdown, intValue, isClosed, isInputShutdown, isOpen, isOutputShutdown, markClosed, outputShutdown, pipe, read, readAddress, write, writeAddress, writev, writevAddresses
-
Field Details
-
isIpv6Preferred
private static volatile boolean isIpv6Preferred -
UDS_SUN_PATH_SIZE
Deprecated.- See Also:
-
ipv6
protected final boolean ipv6
-
-
Constructor Details
-
Socket
public Socket(int fd)
-
-
Method Details
-
useIpv6
Returnstrue
if we should use IPv6 internally,false
otherwise. -
useIpv6
Returnstrue
if the given socket and address combination should use IPv6 internally,false
otherwise. -
shutdown
- Throws:
IOException
-
shutdown
- Throws:
IOException
-
isShutdown
public final boolean isShutdown() -
isInputShutdown
public final boolean isInputShutdown() -
isOutputShutdown
public final boolean isOutputShutdown() -
sendTo
public final int sendTo(ByteBuffer buf, int pos, int limit, InetAddress addr, int port) throws IOException - Throws:
IOException
-
sendTo
public final int sendTo(ByteBuffer buf, int pos, int limit, InetAddress addr, int port, boolean fastOpen) throws IOException - Throws:
IOException
-
sendToDomainSocket
public final int sendToDomainSocket(ByteBuffer buf, int pos, int limit, byte[] path) throws IOException - Throws:
IOException
-
sendToAddress
public final int sendToAddress(long memoryAddress, int pos, int limit, InetAddress addr, int port) throws IOException - Throws:
IOException
-
sendToAddress
public final int sendToAddress(long memoryAddress, int pos, int limit, InetAddress addr, int port, boolean fastOpen) throws IOException - Throws:
IOException
-
sendToAddressDomainSocket
public final int sendToAddressDomainSocket(long memoryAddress, int pos, int limit, byte[] path) throws IOException - Throws:
IOException
-
sendToAddresses
public final int sendToAddresses(long memoryAddress, int length, InetAddress addr, int port) throws IOException - Throws:
IOException
-
sendToAddresses
public final int sendToAddresses(long memoryAddress, int length, InetAddress addr, int port, boolean fastOpen) throws IOException - Throws:
IOException
-
sendToAddressesDomainSocket
public final int sendToAddressesDomainSocket(long memoryAddress, int length, byte[] path) throws IOException - Throws:
IOException
-
recvFrom
- Throws:
IOException
-
recvFromAddress
public final DatagramSocketAddress recvFromAddress(long memoryAddress, int pos, int limit) throws IOException - Throws:
IOException
-
recvFromDomainSocket
public final DomainDatagramSocketAddress recvFromDomainSocket(ByteBuffer buf, int pos, int limit) throws IOException - Throws:
IOException
-
recvFromAddressDomainSocket
public final DomainDatagramSocketAddress recvFromAddressDomainSocket(long memoryAddress, int pos, int limit) throws IOException - Throws:
IOException
-
recv
- Throws:
IOException
-
recvAddress
- Throws:
IOException
-
send
- Throws:
IOException
-
sendAddress
- Throws:
IOException
-
recvFd
- Throws:
IOException
-
sendFd
- Throws:
IOException
-
connect
- Throws:
IOException
-
finishConnect
- Throws:
IOException
-
disconnect
- Throws:
IOException
-
bind
- Throws:
IOException
-
listen
- Throws:
IOException
-
accept
- Throws:
IOException
-
remoteAddress
-
remoteDomainSocketAddress
-
localAddress
-
localDomainSocketAddress
-
getReceiveBufferSize
- Throws:
IOException
-
getSendBufferSize
- Throws:
IOException
-
isKeepAlive
- Throws:
IOException
-
isTcpNoDelay
- Throws:
IOException
-
isReuseAddress
- Throws:
IOException
-
isReusePort
- Throws:
IOException
-
isBroadcast
- Throws:
IOException
-
getSoLinger
- Throws:
IOException
-
getSoError
- Throws:
IOException
-
getTrafficClass
- Throws:
IOException
-
setKeepAlive
- Throws:
IOException
-
setReceiveBufferSize
- Throws:
IOException
-
setSendBufferSize
- Throws:
IOException
-
setTcpNoDelay
- Throws:
IOException
-
setSoLinger
- Throws:
IOException
-
setReuseAddress
- Throws:
IOException
-
setReusePort
- Throws:
IOException
-
setBroadcast
- Throws:
IOException
-
setTrafficClass
- Throws:
IOException
-
setIntOpt
- Throws:
IOException
-
setRawOpt
- Throws:
IOException
-
getIntOpt
- Throws:
IOException
-
getRawOpt
- Throws:
IOException
-
isIPv6Preferred
public static boolean isIPv6Preferred() -
shouldUseIpv6
-
isIPv6Preferred0
private static boolean isIPv6Preferred0(boolean ipv4Preferred) -
isIPv6
private static boolean isIPv6(int fd) -
toString
- Overrides:
toString
in classFileDescriptor
-
newSocketStream
-
newSocketDgram
-
newSocketDomain
-
newSocketDomainDgram
-
initialize
public static void initialize() -
newSocketStream0
protected static int newSocketStream0() -
newSocketStream0
-
newSocketStream0
protected static int newSocketStream0(boolean ipv6) -
newSocketDgram0
protected static int newSocketDgram0() -
newSocketDgram0
-
newSocketDgram0
protected static int newSocketDgram0(boolean ipv6) -
newSocketDomain0
protected static int newSocketDomain0() -
newSocketDomainDgram0
protected static int newSocketDomainDgram0() -
shutdown
private static int shutdown(int fd, boolean read, boolean write) -
connect
private static int connect(int fd, boolean ipv6, byte[] address, int scopeId, int port) -
connectDomainSocket
private static int connectDomainSocket(int fd, byte[] path) -
finishConnect
private static int finishConnect(int fd) -
disconnect
private static int disconnect(int fd, boolean ipv6) -
bind
private static int bind(int fd, boolean ipv6, byte[] address, int scopeId, int port) -
bindDomainSocket
private static int bindDomainSocket(int fd, byte[] path) -
listen
private static int listen(int fd, int backlog) -
accept
private static int accept(int fd, byte[] addr) -
remoteAddress
private static byte[] remoteAddress(int fd) -
remoteDomainSocketAddress
private static byte[] remoteDomainSocketAddress(int fd) -
localAddress
private static byte[] localAddress(int fd) -
localDomainSocketAddress
private static byte[] localDomainSocketAddress(int fd) -
send
-
sendAddress
private static int sendAddress(int fd, long address, int pos, int limit) -
recv
-
recvAddress
private static int recvAddress(int fd, long address, int pos, int limit) -
sendTo
private static int sendTo(int fd, boolean ipv6, ByteBuffer buf, int pos, int limit, byte[] address, int scopeId, int port, int flags) -
sendToAddress
private static int sendToAddress(int fd, boolean ipv6, long memoryAddress, int pos, int limit, byte[] address, int scopeId, int port, int flags) -
sendToAddresses
private static int sendToAddresses(int fd, boolean ipv6, long memoryAddress, int length, byte[] address, int scopeId, int port, int flags) -
sendToDomainSocket
-
sendToAddressDomainSocket
private static int sendToAddressDomainSocket(int fd, long memoryAddress, int pos, int limit, byte[] path) -
sendToAddressesDomainSocket
private static int sendToAddressesDomainSocket(int fd, long memoryAddress, int length, byte[] path) -
recvFrom
private static DatagramSocketAddress recvFrom(int fd, ByteBuffer buf, int pos, int limit) throws IOException - Throws:
IOException
-
recvFromAddress
private static DatagramSocketAddress recvFromAddress(int fd, long memoryAddress, int pos, int limit) throws IOException - Throws:
IOException
-
recvFromDomainSocket
private static DomainDatagramSocketAddress recvFromDomainSocket(int fd, ByteBuffer buf, int pos, int limit) throws IOException - Throws:
IOException
-
recvFromAddressDomainSocket
private static DomainDatagramSocketAddress recvFromAddressDomainSocket(int fd, long memoryAddress, int pos, int limit) throws IOException - Throws:
IOException
-
recvFd
private static int recvFd(int fd) -
sendFd
private static int sendFd(int socketFd, int fd) -
msgFastopen
private static int msgFastopen() -
newSocketStreamFd
private static int newSocketStreamFd(boolean ipv6) -
newSocketDgramFd
private static int newSocketDgramFd(boolean ipv6) -
newSocketDomainFd
private static int newSocketDomainFd() -
newSocketDomainDgramFd
private static int newSocketDomainDgramFd() -
isReuseAddress
- Throws:
IOException
-
isReusePort
- Throws:
IOException
-
getReceiveBufferSize
- Throws:
IOException
-
getSendBufferSize
- Throws:
IOException
-
isKeepAlive
- Throws:
IOException
-
isTcpNoDelay
- Throws:
IOException
-
isBroadcast
- Throws:
IOException
-
getSoLinger
- Throws:
IOException
-
getSoError
- Throws:
IOException
-
getTrafficClass
- Throws:
IOException
-
setReuseAddress
- Throws:
IOException
-
setReusePort
- Throws:
IOException
-
setKeepAlive
- Throws:
IOException
-
setReceiveBufferSize
- Throws:
IOException
-
setSendBufferSize
- Throws:
IOException
-
setTcpNoDelay
- Throws:
IOException
-
setSoLinger
- Throws:
IOException
-
setBroadcast
- Throws:
IOException
-
setTrafficClass
- Throws:
IOException
-
setIntOpt
- Throws:
IOException
-
setRawOptArray
private static void setRawOptArray(int fd, int level, int optname, byte[] optvalue, int offset, int length) throws IOException - Throws:
IOException
-
setRawOptAddress
private static void setRawOptAddress(int fd, int level, int optname, long optvalueMemoryAddress, int length) throws IOException - Throws:
IOException
-
getIntOpt
- Throws:
IOException
-
getRawOptArray
private static void getRawOptArray(int fd, int level, int optname, byte[] out, int offset, int length) throws IOException - Throws:
IOException
-
getRawOptAddress
private static void getRawOptAddress(int fd, int level, int optname, long outMemoryAddress, int length) throws IOException - Throws:
IOException
-