Top Description Fields Constructors Methods
io.netty.channel.kqueue

pack-priv final Class BsdSocket

extends Socket
Class Inheritance
Imports
io.netty.channel.DefaultFileRegion, io.netty.channel.socket.InternetProtocolFamily, io.netty.channel.unix.IovArray, .PeerCredentials, .Socket, java.io.IOException, java.net.Inet6Address, .InetAddress, .InetSocketAddress

A socket which provides access BSD native methods.

Field Summary

Modifier and TypeField and Description
private static final int
pack-priv static final int
private static final int
private static final int
UNSPECIFIED_SOURCE_INTERFACE

The `endpoints` structure passed to `connectx(2)` has an optional "source interface" field, which is the index of the network interface to use.

Inherited from io.netty.channel.unix.Socket:
ipv6UDS_SUN_PATH_SIZE

Constructor Summary

AccessConstructor and Description
pack-priv
BsdSocket(int fd)

Method Summary

Modifier and TypeMethod and Description
pack-priv int

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.
connectx
(InetSocketAddress
the source address we are connecting from.
source
,
InetSocketAddress
the destination address we are connecting to.
destination
,
IovArray
the data to copy to the kernel-side socket buffer.
data
,
boolean
if true, set the flags needed to enable TCP FastOpen connecting.
tcpFastOpen
)

Establish a connection to the given destination address, and send the given data to it

Note

This method relies on the connectx(2) system call, which is MacOS specific.

private static native int

Returns:

If successful, zero or positive number of bytes transfered, otherwise negative errno.
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)

pack-priv AcceptFilter
private static native String[]
pack-priv PeerCredentials
private static native PeerCredentials
pack-priv int
private static native int
getSndLowAt(int fd)

private static native int
getTcpNoPush(int fd)

public boolean
private static native int
isTcpFastOpen(int fd)

pack-priv boolean
public static BsdSocket
public static BsdSocket
public static BsdSocket
public static BsdSocket
public static BsdSocket
public static BsdSocket
pack-priv long
sendFile(DefaultFileRegion src, long baseOffset, long offset, long length)

private static native long
sendFile(int socketFd, DefaultFileRegion src, long baseOffset, long offset, long length)

pack-priv void
private static native void
setAcceptFilter(int fd, String filterName, String filterArgs)

pack-priv void
setSndLowAt(int lowAt)

private static native void
setSndLowAt(int fd, int lowAt)

public void
setTcpFastOpen(boolean enableTcpFastOpen)

private static native void
setTcpFastOpen(int fd, int enableFastOpen)

pack-priv void
setTcpNoPush(boolean tcpNoPush)

private static native void
setTcpNoPush(int fd, int tcpNoPush)

Inherited from io.netty.channel.unix.Socket:
acceptbindconnectdisconnectfinishConnectgetIntOptgetRawOptgetReceiveBufferSizegetSendBufferSizegetSoErrorgetSoLingergetTrafficClassinitializeisBroadcastisInputShutdownisIPv6PreferredisKeepAliveisOutputShutdownisReuseAddressisReusePortisShutdownisTcpNoDelaylistenlocalAddresslocalDomainSocketAddressnewSocketDgram0newSocketDgram0newSocketDgram0newSocketDomain0newSocketDomainDgram0newSocketStream0newSocketStream0newSocketStream0recvrecvAddressrecvFdrecvFromrecvFromAddressrecvFromAddressDomainSocketrecvFromDomainSocketremoteAddressremoteDomainSocketAddresssendsendAddresssendFdsendTosendTosendToAddresssendToAddresssendToAddressDomainSocketsendToAddressessendToAddressessendToAddressesDomainSocketsendToDomainSocketsetBroadcastsetIntOptsetKeepAlivesetRawOptsetReceiveBufferSizesetReuseAddresssetReusePortsetSendBufferSizesetSoLingersetTcpNoDelaysetTrafficClassshouldUseIpv6shutdownshutdowntoStringuseIpv6

Field Detail

APPLE_SND_LOW_AT_MAXback to summary
private static final int APPLE_SND_LOW_AT_MAX
BSD_SND_LOW_AT_MAXback to summary
pack-priv static final int BSD_SND_LOW_AT_MAX
FREEBSD_SND_LOW_AT_MAXback to summary
private static final int FREEBSD_SND_LOW_AT_MAX
UNSPECIFIED_SOURCE_INTERFACEback to summary
private static final int UNSPECIFIED_SOURCE_INTERFACE

The `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.

Constructor Detail

BsdSocketback to summary
pack-priv BsdSocket(int fd)

Method Detail

connectxback to summary
pack-priv 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 the connectx(2) system call, which is MacOS specific.

Parameters
source:InetSocketAddress

the source address we are connecting from.

destination:InetSocketAddress

the destination address we are connecting to.

data:IovArray

the data to copy to the kernel-side socket buffer.

tcpFastOpen:boolean

if true, set the flags needed to enable TCP FastOpen connecting.

Returns:int

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.

Exceptions
IOException:
if an IO error occurs, if the data is too big to send in one go, or if the system call is not supported on your platform.
connectxback to summary
private static native 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:int

If successful, zero or positive number of bytes transfered, otherwise negative errno.

getAcceptFilterback to summary
pack-priv AcceptFilter getAcceptFilter() throws IOException
getAcceptFilterback to summary
private static native String[] getAcceptFilter(int fd) throws IOException
getPeerCredentialsback to summary
pack-priv PeerCredentials getPeerCredentials() throws IOException
getPeerCredentialsback to summary
private static native PeerCredentials getPeerCredentials(int fd) throws IOException
getSndLowAtback to summary
pack-priv int getSndLowAt() throws IOException
getSndLowAtback to summary
private static native int getSndLowAt(int fd) throws IOException
getTcpNoPushback to summary
private static native int getTcpNoPush(int fd) throws IOException
isTcpFastOpenback to summary
public boolean isTcpFastOpen() throws IOException
isTcpFastOpenback to summary
private static native int isTcpFastOpen(int fd) throws IOException
isTcpNoPushback to summary
pack-priv boolean isTcpNoPush() throws IOException
newSocketDgramback to summary
public static BsdSocket newSocketDgram()

Hides io.netty.channel.unix.Socket.newSocketDgram.

newSocketDgramback to summary
public static BsdSocket newSocketDgram(InternetProtocolFamily protocol)
newSocketDomainback to summary
public static BsdSocket newSocketDomain()

Hides io.netty.channel.unix.Socket.newSocketDomain.

newSocketDomainDgramback to summary
public static BsdSocket newSocketDomainDgram()

Hides io.netty.channel.unix.Socket.newSocketDomainDgram.

newSocketStreamback to summary
public static BsdSocket newSocketStream()

Hides io.netty.channel.unix.Socket.newSocketStream.

newSocketStreamback to summary
public static BsdSocket newSocketStream(InternetProtocolFamily protocol)
sendFileback to summary
pack-priv long sendFile(DefaultFileRegion src, long baseOffset, long offset, long length) throws IOException
sendFileback to summary
private static native long sendFile(int socketFd, DefaultFileRegion src, long baseOffset, long offset, long length) throws IOException
setAcceptFilterback to summary
pack-priv void setAcceptFilter(AcceptFilter acceptFilter) throws IOException
setAcceptFilterback to summary
private static native void setAcceptFilter(int fd, String filterName, String filterArgs) throws IOException
setSndLowAtback to summary
pack-priv void setSndLowAt(int lowAt) throws IOException
setSndLowAtback to summary
private static native void setSndLowAt(int fd, int lowAt) throws IOException
setTcpFastOpenback to summary
public void setTcpFastOpen(boolean enableTcpFastOpen) throws IOException
setTcpFastOpenback to summary
private static native void setTcpFastOpen(int fd, int enableFastOpen) throws IOException
setTcpNoPushback to summary
pack-priv void setTcpNoPush(boolean tcpNoPush) throws IOException
setTcpNoPushback to summary
private static native void setTcpNoPush(int fd, int tcpNoPush) throws IOException