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 booleanprivate static booleanstatic final intDeprecated.Fields inherited from class io.netty.channel.unix.FileDescriptor
fd, state -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intaccept(byte[] addr) private static intaccept(int fd, byte[] addr) private static intbind(int fd, boolean ipv6, byte[] address, int scopeId, int port) final voidbind(SocketAddress socketAddress) private static intbindDomainSocket(int fd, byte[] path) private static intconnect(int fd, boolean ipv6, byte[] address, int scopeId, int port) final booleanconnect(SocketAddress socketAddress) private static intconnectDomainSocket(int fd, byte[] path) final voidprivate static intdisconnect(int fd, boolean ipv6) final booleanprivate static intfinishConnect(int fd) intgetIntOpt(int level, int optname) private static intgetIntOpt(int fd, int level, int optname) voidgetRawOpt(int level, int optname, ByteBuffer out) private static voidgetRawOptAddress(int fd, int level, int optname, long outMemoryAddress, int length) private static voidgetRawOptArray(int fd, int level, int optname, byte[] out, int offset, int length) final intprivate static intgetReceiveBufferSize(int fd) final intprivate static intgetSendBufferSize(int fd) final intprivate static intgetSoError(int fd) final intprivate static intgetSoLinger(int fd) final intprivate static intgetTrafficClass(int fd, boolean ipv6) static voidfinal booleanprivate static intisBroadcast(int fd) final booleanprivate static booleanisIPv6(int fd) static booleanprivate static booleanisIPv6Preferred0(boolean ipv4Preferred) final booleanprivate static intisKeepAlive(int fd) final booleanfinal booleanprivate static intisReuseAddress(int fd) final booleanprivate static intisReusePort(int fd) final booleanfinal booleanprivate static intisTcpNoDelay(int fd) final voidlisten(int backlog) private static intlisten(int fd, int backlog) final InetSocketAddressprivate static byte[]localAddress(int fd) final DomainSocketAddressprivate static byte[]localDomainSocketAddress(int fd) private static intstatic Socketprotected static intprotected static intnewSocketDgram0(boolean ipv6) protected static intprivate static intnewSocketDgramFd(boolean ipv6) static Socketprotected static intstatic Socketprotected static intprivate static intprivate static intstatic Socketprotected static intprotected static intnewSocketStream0(boolean ipv6) protected static intnewSocketStream0(InternetProtocolFamily protocol) private static intnewSocketStreamFd(boolean ipv6) private static intrecv(int fd, ByteBuffer buf, int pos, int limit) intrecv(ByteBuffer buf, int pos, int limit) private static intrecvAddress(int fd, long address, int pos, int limit) intrecvAddress(long address, int pos, int limit) final intrecvFd()private static intrecvFd(int fd) private static DatagramSocketAddressrecvFrom(int fd, ByteBuffer buf, int pos, int limit) final DatagramSocketAddressrecvFrom(ByteBuffer buf, int pos, int limit) private static DatagramSocketAddressrecvFromAddress(int fd, long memoryAddress, int pos, int limit) final DatagramSocketAddressrecvFromAddress(long memoryAddress, int pos, int limit) private static DomainDatagramSocketAddressrecvFromAddressDomainSocket(int fd, long memoryAddress, int pos, int limit) recvFromAddressDomainSocket(long memoryAddress, int pos, int limit) private static DomainDatagramSocketAddressrecvFromDomainSocket(int fd, ByteBuffer buf, int pos, int limit) recvFromDomainSocket(ByteBuffer buf, int pos, int limit) final InetSocketAddressprivate static byte[]remoteAddress(int fd) final DomainSocketAddressprivate static byte[]remoteDomainSocketAddress(int fd) private static intsend(int fd, ByteBuffer buf, int pos, int limit) intsend(ByteBuffer buf, int pos, int limit) private static intsendAddress(int fd, long address, int pos, int limit) intsendAddress(long address, int pos, int limit) final intsendFd(int fdToSend) private static intsendFd(int socketFd, int fd) private static intsendTo(int fd, boolean ipv6, ByteBuffer buf, int pos, int limit, byte[] address, int scopeId, int port, int flags) final intsendTo(ByteBuffer buf, int pos, int limit, InetAddress addr, int port) final intsendTo(ByteBuffer buf, int pos, int limit, InetAddress addr, int port, boolean fastOpen) private static intsendToAddress(int fd, boolean ipv6, long memoryAddress, int pos, int limit, byte[] address, int scopeId, int port, int flags) final intsendToAddress(long memoryAddress, int pos, int limit, InetAddress addr, int port) final intsendToAddress(long memoryAddress, int pos, int limit, InetAddress addr, int port, boolean fastOpen) private static intsendToAddressDomainSocket(int fd, long memoryAddress, int pos, int limit, byte[] path) final intsendToAddressDomainSocket(long memoryAddress, int pos, int limit, byte[] path) private static intsendToAddresses(int fd, boolean ipv6, long memoryAddress, int length, byte[] address, int scopeId, int port, int flags) final intsendToAddresses(long memoryAddress, int length, InetAddress addr, int port) final intsendToAddresses(long memoryAddress, int length, InetAddress addr, int port, boolean fastOpen) private static intsendToAddressesDomainSocket(int fd, long memoryAddress, int length, byte[] path) final intsendToAddressesDomainSocket(long memoryAddress, int length, byte[] path) private static intsendToDomainSocket(int fd, ByteBuffer buf, int pos, int limit, byte[] path) final intsendToDomainSocket(ByteBuffer buf, int pos, int limit, byte[] path) final voidsetBroadcast(boolean broadcast) private static voidsetBroadcast(int fd, int broadcast) voidsetIntOpt(int level, int optname, int optvalue) private static voidsetIntOpt(int fd, int level, int optname, int optvalue) final voidsetKeepAlive(boolean keepAlive) private static voidsetKeepAlive(int fd, int keepAlive) voidsetRawOpt(int level, int optname, ByteBuffer optvalue) private static voidsetRawOptAddress(int fd, int level, int optname, long optvalueMemoryAddress, int length) private static voidsetRawOptArray(int fd, int level, int optname, byte[] optvalue, int offset, int length) final voidsetReceiveBufferSize(int receiveBufferSize) private static voidsetReceiveBufferSize(int fd, int receiveBufferSize) final voidsetReuseAddress(boolean reuseAddress) private static voidsetReuseAddress(int fd, int reuseAddress) final voidsetReusePort(boolean reusePort) private static voidsetReusePort(int fd, int reuseAddress) final voidsetSendBufferSize(int sendBufferSize) private static voidsetSendBufferSize(int fd, int sendBufferSize) final voidsetSoLinger(int soLinger) private static voidsetSoLinger(int fd, int soLinger) final voidsetTcpNoDelay(boolean tcpNoDelay) private static voidsetTcpNoDelay(int fd, int tcpNoDelay) final voidsetTrafficClass(int trafficClass) private static voidsetTrafficClass(int fd, boolean ipv6, int trafficClass) static booleanshouldUseIpv6(InternetProtocolFamily family) final voidshutdown()final voidshutdown(boolean read, boolean write) private static intshutdown(int fd, boolean read, boolean write) toString()protected static booleanuseIpv6(Socket socket, InetAddress address) Returnstrueif the given socket and address combination should use IPv6 internally,falseotherwise.private booleanuseIpv6(InetAddress address) Returnstrueif we should use IPv6 internally,falseotherwise.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
Returnstrueif we should use IPv6 internally,falseotherwise. -
useIpv6
Returnstrueif the given socket and address combination should use IPv6 internally,falseotherwise. -
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:
toStringin 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
-