Class Socket
java.lang.Object
io.netty.channel.unix.FileDescriptor
io.netty.channel.unix.Socket
- Direct Known Subclasses:
LinuxSocket
Provides a JNI bridge to native socket operations.
Internal usage only!
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanstatic final intDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intaccept(byte[] addr) final voidbind(SocketAddress socketAddress) final booleanconnect(SocketAddress socketAddress) final voidfinal booleanintgetIntOpt(int level, int optname) voidgetRawOpt(int level, int optname, ByteBuffer out) final intfinal intfinal intfinal intfinal intstatic voidfinal booleanfinal booleanstatic booleanfinal booleanfinal booleanfinal booleanfinal booleanfinal booleanfinal booleanfinal voidlisten(int backlog) final InetSocketAddressfinal DomainSocketAddressstatic Socketprotected static intprotected static intnewSocketDgram0(boolean ipv6) protected static intDeprecated.protected static intnewSocketDgram0(SocketProtocolFamily family) static Socketprotected static intstatic Socketprotected static intstatic Socketprotected static intprotected static intnewSocketStream0(boolean ipv6) protected static intnewSocketStream0(InternetProtocolFamily protocol) Deprecated.protected static intnewSocketStream0(SocketProtocolFamily protocol) intrecv(ByteBuffer buf, int pos, int limit) intrecvAddress(long address, int pos, int limit) final intrecvFd()final DatagramSocketAddressrecvFrom(ByteBuffer buf, int pos, int limit) final DatagramSocketAddressrecvFromAddress(long memoryAddress, int pos, int limit) recvFromAddressDomainSocket(long memoryAddress, int pos, int limit) recvFromDomainSocket(ByteBuffer buf, int pos, int limit) final InetSocketAddressfinal DomainSocketAddressintsend(ByteBuffer buf, int pos, int limit) intsendAddress(long address, int pos, int limit) final intsendFd(int fdToSend) 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) 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) final intsendToAddressDomainSocket(long memoryAddress, int pos, int limit, byte[] path) final intsendToAddresses(long memoryAddress, int length, InetAddress addr, int port) final intsendToAddresses(long memoryAddress, int length, InetAddress addr, int port, boolean fastOpen) final intsendToAddressesDomainSocket(long memoryAddress, int length, byte[] path) final intsendToDomainSocket(ByteBuffer buf, int pos, int limit, byte[] path) final voidsetBroadcast(boolean broadcast) voidsetIntOpt(int level, int optname, int optvalue) final voidsetKeepAlive(boolean keepAlive) voidsetRawOpt(int level, int optname, ByteBuffer optvalue) final voidsetReceiveBufferSize(int receiveBufferSize) final voidsetReuseAddress(boolean reuseAddress) final voidsetReusePort(boolean reusePort) final voidsetSendBufferSize(int sendBufferSize) final voidsetSoLinger(int soLinger) final voidsetTcpNoDelay(boolean tcpNoDelay) final voidsetTrafficClass(int trafficClass) static booleanshouldUseIpv6(InternetProtocolFamily family) Deprecated.static booleanshouldUseIpv6(SocketProtocolFamily family) final voidshutdown()final voidshutdown(boolean read, boolean write) toString()protected static booleanuseIpv6(Socket socket, InetAddress address) Returnstrueif the given socket and address combination should use IPv6 internally,falseotherwise.Methods inherited from class FileDescriptor
close, equals, from, from, hashCode, intValue, isOpen, markClosed, pipe, read, readAddress, write, writeAddress, writev, writevAddresses
-
Field Details
-
UDS_SUN_PATH_SIZE
-
ipv6
protected final boolean ipv6
-
-
Constructor Details
-
Socket
public Socket(int fd)
-
-
Method Details
-
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
Deprecated. -
shouldUseIpv6
-
toString
- Overrides:
toStringin classFileDescriptor
-
newSocketStream
-
newSocketDgram
-
newSocketDomain
-
newSocketDomainDgram
-
initialize
public static void initialize() -
newSocketStream0
protected static int newSocketStream0() -
newSocketStream0
Deprecated.- Parameters:
protocol-- Returns:
-
newSocketStream0
-
newSocketStream0
protected static int newSocketStream0(boolean ipv6) -
newSocketDgram0
protected static int newSocketDgram0() -
newSocketDgram0
Deprecated. -
newSocketDgram0
-
newSocketDgram0
protected static int newSocketDgram0(boolean ipv6) -
newSocketDomain0
protected static int newSocketDomain0() -
newSocketDomainDgram0
protected static int newSocketDomainDgram0()
-
newSocketDgram0(SocketProtocolFamily)