Package zmq.io.net.tcp
Class TcpUtils
- java.lang.Object
-
- zmq.io.net.tcp.TcpUtils
-
public class TcpUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interface
TcpUtils.OptionSetter
private static class
TcpUtils.SocketOptionSetter
-
Constructor Summary
Constructors Modifier Constructor Description private
TcpUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
enableIpv4Mapping(java.nio.channels.SelectableChannel channel)
static Address
getPeerIpAddress(java.nio.channels.SocketChannel channel)
static boolean
setIpTypeOfService(java.nio.channels.Channel channel, int tos)
private static boolean
setOption(java.nio.channels.Channel channel, TcpUtils.OptionSetter setter)
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.SocketChannel channel, int tcpKeepAlive, int tcpKeepAliveCnt, int tcpKeepAliveIdle, int tcpKeepAliveIntvl)
static void
tuneTcpSocket(java.nio.channels.SocketChannel channel)
static void
unblockSocket(java.nio.channels.SelectableChannel... channels)
-
-
-
Method Detail
-
tuneTcpSocket
public static void tuneTcpSocket(java.nio.channels.SocketChannel channel) throws java.io.IOException
- Throws:
java.io.IOException
-
tuneTcpKeepalives
public static void tuneTcpKeepalives(java.nio.channels.SocketChannel channel, int tcpKeepAlive, int tcpKeepAliveCnt, int tcpKeepAliveIdle, int tcpKeepAliveIntvl) throws java.io.IOException
- Throws:
java.io.IOException
-
setTcpReceiveBuffer
public static boolean setTcpReceiveBuffer(java.nio.channels.Channel channel, int rcvbuf)
-
setTcpSendBuffer
public static boolean setTcpSendBuffer(java.nio.channels.Channel channel, int sndbuf)
-
setIpTypeOfService
public static boolean setIpTypeOfService(java.nio.channels.Channel channel, int tos)
-
setReuseAddress
public static boolean setReuseAddress(java.nio.channels.Channel channel, boolean reuse)
-
setOption
private static boolean setOption(java.nio.channels.Channel channel, TcpUtils.OptionSetter setter)
-
unblockSocket
public static void unblockSocket(java.nio.channels.SelectableChannel... channels) throws java.io.IOException
- Throws:
java.io.IOException
-
enableIpv4Mapping
public static void enableIpv4Mapping(java.nio.channels.SelectableChannel channel)
-
getPeerIpAddress
public static Address getPeerIpAddress(java.nio.channels.SocketChannel channel)
-
-