public class TcpUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
TcpUtils.SocketOptionsProvider |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
WITH_EXTENDED_KEEPALIVE |
| Modifier | Constructor and Description |
|---|---|
private |
TcpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
enableIpv4Mapping(java.nio.channels.SelectableChannel channel) |
static Address |
getPeerIpAddress(java.nio.channels.SocketChannel channel)
Deprecated.
Use
Utils.getPeerIpAddress(SocketChannel) instead |
static boolean |
setIpTypeOfService(java.nio.channels.Channel channel,
int tos) |
private static <T> void |
setOption(java.nio.channels.Channel channel,
java.net.SocketOption<T> option,
T value) |
static boolean |
setReuseAddress(java.nio.channels.Channel channel,
boolean reuse) |
static boolean |
setTcpReceiveBuffer(java.nio.channels.Channel channel,
int rcvbuf) |
static boolean |
setTcpSendBuffer(java.nio.channels.Channel channel,
int sndbuf) |
static void |
tuneTcpKeepalives(java.nio.channels.Channel channel,
int tcpKeepAlive,
int tcpKeepAliveCnt,
int tcpKeepAliveIdle,
int tcpKeepAliveIntvl) |
static void |
tuneTcpSocket(java.nio.channels.Channel channel) |
static void |
unblockSocket(java.nio.channels.SelectableChannel... channels) |
public static void tuneTcpSocket(java.nio.channels.Channel channel)
throws java.io.IOException
java.io.IOExceptionpublic static void tuneTcpKeepalives(java.nio.channels.Channel channel,
int tcpKeepAlive,
int tcpKeepAliveCnt,
int tcpKeepAliveIdle,
int tcpKeepAliveIntvl)
public static boolean setTcpReceiveBuffer(java.nio.channels.Channel channel,
int rcvbuf)
public static boolean setTcpSendBuffer(java.nio.channels.Channel channel,
int sndbuf)
public static boolean setIpTypeOfService(java.nio.channels.Channel channel,
int tos)
public static boolean setReuseAddress(java.nio.channels.Channel channel,
boolean reuse)
private static <T> void setOption(java.nio.channels.Channel channel,
java.net.SocketOption<T> option,
T value)
public static void unblockSocket(java.nio.channels.SelectableChannel... channels)
throws java.io.IOException
java.io.IOExceptionpublic static void enableIpv4Mapping(java.nio.channels.SelectableChannel channel)
@Deprecated public static Address getPeerIpAddress(java.nio.channels.SocketChannel channel)
Utils.getPeerIpAddress(SocketChannel) insteadAddress of the channelchannel - the channel, should be a TCP socket channelAddress of the channelZError.IOException - if the channel is closed or an I/O errors occurredjava.lang.IllegalArgumentException - if the SocketChannel is not a TCP channel