Package io.netty.channel.kqueue
Class BsdSocket
java.lang.Object
io.netty.channel.unix.FileDescriptor
io.netty.channel.unix.Socket
io.netty.channel.kqueue.BsdSocket
A socket which provides access BSD native methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
(package private) static final int
private static final int
private static final int
The `endpoints` structure passed to `connectx(2)` has an optional "source interface" field, which is the index of the network interface to use.Fields inherited from class io.netty.channel.unix.Socket
ipv6, UDS_SUN_PATH_SIZE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
connectx
(int socketFd, int sourceInterface, boolean sourceIPv6, byte[] sourceAddress, int sourceScopeId, int sourcePort, boolean destinationIPv6, byte[] destinationAddress, int destinationScopeId, int destinationPort, int flags, long iovAddress, int iovCount, int iovDataLength) (package private) int
connectx
(InetSocketAddress source, InetSocketAddress destination, IovArray data, boolean tcpFastOpen) Establish a connection to the given destination address, and send the given data to it.(package private) AcceptFilter
private static String[]
getAcceptFilter
(int fd) (package private) PeerCredentials
private static PeerCredentials
getPeerCredentials
(int fd) (package private) int
private static int
getSndLowAt
(int fd) private static int
getTcpNoPush
(int fd) boolean
private static int
isTcpFastOpen
(int fd) (package private) boolean
static BsdSocket
static BsdSocket
newSocketDgram
(InternetProtocolFamily protocol) static BsdSocket
static BsdSocket
static BsdSocket
static BsdSocket
newSocketStream
(InternetProtocolFamily protocol) private static long
sendFile
(int socketFd, DefaultFileRegion src, long baseOffset, long offset, long length) (package private) long
sendFile
(DefaultFileRegion src, long baseOffset, long offset, long length) private static void
setAcceptFilter
(int fd, String filterName, String filterArgs) (package private) void
setAcceptFilter
(AcceptFilter acceptFilter) (package private) void
setSndLowAt
(int lowAt) private static void
setSndLowAt
(int fd, int lowAt) void
setTcpFastOpen
(boolean enableTcpFastOpen) private static void
setTcpFastOpen
(int fd, int enableFastOpen) (package private) void
setTcpNoPush
(boolean tcpNoPush) private static void
setTcpNoPush
(int fd, int tcpNoPush) Methods inherited from class io.netty.channel.unix.Socket
accept, bind, connect, disconnect, finishConnect, getIntOpt, getRawOpt, getReceiveBufferSize, getSendBufferSize, getSoError, getSoLinger, getTrafficClass, initialize, isBroadcast, isInputShutdown, isIPv6Preferred, isKeepAlive, isOutputShutdown, isReuseAddress, isReusePort, isShutdown, isTcpNoDelay, listen, localAddress, localDomainSocketAddress, newSocketDgram0, newSocketDgram0, newSocketDgram0, newSocketDomain0, newSocketDomainDgram0, newSocketStream0, newSocketStream0, newSocketStream0, recv, recvAddress, recvFd, recvFrom, recvFromAddress, recvFromAddressDomainSocket, recvFromDomainSocket, remoteAddress, remoteDomainSocketAddress, send, sendAddress, sendFd, sendTo, sendTo, sendToAddress, sendToAddress, sendToAddressDomainSocket, sendToAddresses, sendToAddresses, sendToAddressesDomainSocket, sendToDomainSocket, setBroadcast, setIntOpt, setKeepAlive, setRawOpt, setReceiveBufferSize, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClass, shouldUseIpv6, shutdown, shutdown, toString, useIpv6
Methods inherited from class io.netty.channel.unix.FileDescriptor
close, equals, from, from, hashCode, intValue, isOpen, markClosed, pipe, read, readAddress, write, writeAddress, writev, writevAddresses
-
Field Details
-
APPLE_SND_LOW_AT_MAX
private static final int APPLE_SND_LOW_AT_MAX- See Also:
-
FREEBSD_SND_LOW_AT_MAX
private static final int FREEBSD_SND_LOW_AT_MAX- See Also:
-
BSD_SND_LOW_AT_MAX
static final int BSD_SND_LOW_AT_MAX -
UNSPECIFIED_SOURCE_INTERFACE
private static final int UNSPECIFIED_SOURCE_INTERFACEThe `endpoints` structure passed to `connectx(2)` has an optional "source interface" field, which is the index of the network interface to use. According to `if_nametoindex(3)`, the value 0 is used when no interface is specified.- See Also:
-
-
Constructor Details
-
BsdSocket
BsdSocket(int fd)
-
-
Method Details
-
setAcceptFilter
- Throws:
IOException
-
setTcpNoPush
- Throws:
IOException
-
setSndLowAt
- Throws:
IOException
-
setTcpFastOpen
- Throws:
IOException
-
isTcpNoPush
- Throws:
IOException
-
getSndLowAt
- Throws:
IOException
-
getAcceptFilter
- Throws:
IOException
-
isTcpFastOpen
- Throws:
IOException
-
getPeerCredentials
- Throws:
IOException
-
sendFile
- Throws:
IOException
-
connectx
int connectx(InetSocketAddress source, InetSocketAddress destination, IovArray data, boolean tcpFastOpen) throws IOException Establish a connection to the given destination address, and send the given data to it. Note: This method relies on theconnectx(2)
system call, which is MacOS specific.- Parameters:
source
- the source address we are connecting from.destination
- the destination address we are connecting to.data
- the data to copy to the kernel-side socket buffer.tcpFastOpen
- iftrue
, set the flags needed to enable TCP FastOpen connecting.- Returns:
- The number of bytes copied to the kernel-side socket buffer, or the number of bytes sent to the destination. This number is negative if connecting is left in an in-progress state, or positive if the connection was immediately established.
- Throws:
IOException
- if an IO error occurs, if thedata
is too big to send in one go, or if the system call is not supported on your platform.
-
newSocketStream
-
newSocketStream
-
newSocketDgram
-
newSocketDgram
-
newSocketDomain
-
newSocketDomainDgram
-
sendFile
private static long sendFile(int socketFd, DefaultFileRegion src, long baseOffset, long offset, long length) throws IOException - Throws:
IOException
-
connectx
private static int connectx(int socketFd, int sourceInterface, boolean sourceIPv6, byte[] sourceAddress, int sourceScopeId, int sourcePort, boolean destinationIPv6, byte[] destinationAddress, int destinationScopeId, int destinationPort, int flags, long iovAddress, int iovCount, int iovDataLength) - Returns:
- If successful, zero or positive number of bytes transfered, otherwise negative errno.
-
getAcceptFilter
- Throws:
IOException
-
getTcpNoPush
- Throws:
IOException
-
getSndLowAt
- Throws:
IOException
-
isTcpFastOpen
- Throws:
IOException
-
getPeerCredentials
- Throws:
IOException
-
setAcceptFilter
private static void setAcceptFilter(int fd, String filterName, String filterArgs) throws IOException - Throws:
IOException
-
setTcpNoPush
- Throws:
IOException
-
setSndLowAt
- Throws:
IOException
-
setTcpFastOpen
- Throws:
IOException
-