Package one.nio.net
Class JavaServerSocket
- java.lang.Object
-
- one.nio.net.Socket
-
- one.nio.net.SelectableJavaSocket
-
- one.nio.net.JavaServerSocket
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.ByteChannel,java.nio.channels.Channel,java.nio.channels.ReadableByteChannel,java.nio.channels.WritableByteChannel
final class JavaServerSocket extends SelectableJavaSocket
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.nio.channels.ServerSocketChannelchprivate static java.net.SocketOption<java.lang.Boolean>SO_REUSEPORT_COMPAT-
Fields inherited from class one.nio.net.SelectableJavaSocket
POLL_READ, POLL_WRITE
-
Fields inherited from class one.nio.net.Socket
AF_INET, AF_INET6, AF_UNIX, IPTOS_LOWDELAY, IPTOS_MINCOST, IPTOS_RELIABILITY, IPTOS_THROUGHPUT, MSG_DONTROUTE, MSG_DONTWAIT, MSG_MORE, MSG_OOB, MSG_PEEK, MSG_TRUNC, MSG_WAITALL, NO_PORT, SO_BROADCAST, SO_BSDCOMPAT, SO_DEBUG, SO_DONTROUTE, SO_ERROR, SO_KEEPALIVE, SO_LINGER, SO_NO_CHECK, SO_OOBINLINE, SO_PASSCRED, SO_PEERCRED, SO_PRIORITY, SO_RCVBUF, SO_RCVLOWAT, SO_RCVTIMEO, SO_REUSEADDR, SO_REUSEPORT, SO_SNDBUF, SO_SNDLOWAT, SO_SNDTIMEO, SO_TYPE, SOCK_DGRAM, SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET, SOCK_STREAM, SOL_IP, SOL_IPV6, SOL_SOCKET, SOL_TCP, SOL_UDP, TCP_CONGESTION, TCP_CORK, TCP_DEFER_ACCEPT, TCP_INFO, TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_LINGER2, TCP_MAXSEG, TCP_NODELAY, TCP_QUICKACK, TCP_SYNCNT, TCP_USER_TIMEOUT, TCP_WINDOW_CLAMP
-
-
Constructor Summary
Constructors Constructor Description JavaServerSocket()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaSocketaccept()voidbind(java.net.InetAddress address, int port, int backlog)voidclose()voidconnect(java.net.InetAddress address, int port)private static java.net.SocketOption<java.lang.Boolean>findReusePortOption()booleangetDeferAccept()booleangetKeepAlive()java.net.InetSocketAddressgetLocalAddress()booleangetNoDelay()byte[]getOption(int level, int option)intgetRecvBuffer()java.net.InetSocketAddressgetRemoteAddress()booleangetReuseAddr()booleangetReusePort()java.nio.channels.SelectableChannelgetSelectableChannel()intgetSendBuffer()SslContextgetSslContext()<T> TgetSslOption(SslOption<T> option)booleangetTcpFastOpen()intgetTimeout()intgetTos()booleanisBlocking()booleanisOpen()voidlisten(int backlog)intread(byte[] data, int offset, int count, int flags)intread(java.nio.ByteBuffer dst)voidreadFully(byte[] data, int offset, int count)intreadRaw(long buf, int count, int flags)java.net.InetSocketAddressrecv(java.nio.ByteBuffer dst, int flags)intrecvMsg(Msg msg, int flags)intsend(java.nio.ByteBuffer src, int flags, java.net.InetAddress address, int port)longsendFile(java.io.RandomAccessFile file, long offset, long count)intsendMsg(Msg msg, int flags)voidsetBlocking(boolean blocking)voidsetDeferAccept(boolean deferAccept)voidsetKeepAlive(boolean keepAlive)voidsetNoDelay(boolean noDelay)booleansetOption(int level, int option, byte[] value)voidsetRecvBuffer(int recvBuf)voidsetReuseAddr(boolean reuseAddr, boolean reusePort)voidsetSendBuffer(int sendBuf)voidsetTcpFastOpen(boolean tcpFastOpen)voidsetTimeout(int timeout)voidsetTos(int tos)SocketsslUnwrap()SocketsslWrap(SslContext context)intwrite(byte[] data, int offset, int count, int flags)intwrite(java.nio.ByteBuffer src)voidwriteFully(byte[] data, int offset, int count)intwriteRaw(long buf, int count, int flags)-
Methods inherited from class one.nio.net.SelectableJavaSocket
checkTimeout
-
Methods inherited from class one.nio.net.Socket
acceptNonBlocking, bind, bindInet, bindUnix, connect, connectInet, connectUnix, create, createClientSocket, createClientSocket, createDatagramSocket, createServerSocket, createUnixSocket, fromFD, getNotsentLowat, getThinLinearTimeouts, handshake, read, send, setNotsentLowat, setThinLinearTimeouts, write
-
-
-
-
Method Detail
-
isOpen
public final boolean isOpen()
-
close
public final void close()
-
accept
public final JavaSocket accept() throws java.io.IOException
-
connect
public final void connect(java.net.InetAddress address, int port) throws java.io.IOException
-
bind
public final void bind(java.net.InetAddress address, int port, int backlog) throws java.io.IOException
-
listen
public final void listen(int backlog) throws java.io.IOException
-
writeRaw
public final int writeRaw(long buf, int count, int flags) throws java.io.IOException
-
write
public final int write(byte[] data, int offset, int count, int flags) throws java.io.IOException
-
writeFully
public final void writeFully(byte[] data, int offset, int count) throws java.io.IOException- Specified by:
writeFullyin classSocket- Throws:
java.io.IOException
-
send
public final int send(java.nio.ByteBuffer src, int flags, java.net.InetAddress address, int port) throws java.io.IOException
-
readRaw
public final int readRaw(long buf, int count, int flags) throws java.io.IOException
-
read
public final int read(byte[] data, int offset, int count, int flags) throws java.io.IOException
-
recv
public final java.net.InetSocketAddress recv(java.nio.ByteBuffer dst, int flags) throws java.io.IOException
-
readFully
public final void readFully(byte[] data, int offset, int count) throws java.io.IOException
-
sendFile
public final long sendFile(java.io.RandomAccessFile file, long offset, long count) throws java.io.IOException
-
read
public final int read(java.nio.ByteBuffer dst) throws java.io.IOException- Throws:
java.io.IOException
-
write
public final int write(java.nio.ByteBuffer src) throws java.io.IOException- Throws:
java.io.IOException
-
sendMsg
public int sendMsg(Msg msg, int flags) throws java.io.IOException
-
recvMsg
public int recvMsg(Msg msg, int flags) throws java.io.IOException
-
setBlocking
public final void setBlocking(boolean blocking)
- Specified by:
setBlockingin classSocket
-
isBlocking
public boolean isBlocking()
- Specified by:
isBlockingin classSocket
-
setTimeout
public final void setTimeout(int timeout)
- Specified by:
setTimeoutin classSocket
-
getTimeout
public int getTimeout()
- Specified by:
getTimeoutin classSocket
-
setKeepAlive
public final void setKeepAlive(boolean keepAlive)
- Specified by:
setKeepAlivein classSocket
-
getKeepAlive
public boolean getKeepAlive()
- Specified by:
getKeepAlivein classSocket
-
setNoDelay
public final void setNoDelay(boolean noDelay)
- Specified by:
setNoDelayin classSocket
-
getNoDelay
public boolean getNoDelay()
- Specified by:
getNoDelayin classSocket
-
setTcpFastOpen
public final void setTcpFastOpen(boolean tcpFastOpen)
- Specified by:
setTcpFastOpenin classSocket
-
getTcpFastOpen
public boolean getTcpFastOpen()
- Specified by:
getTcpFastOpenin classSocket
-
setDeferAccept
public final void setDeferAccept(boolean deferAccept)
- Specified by:
setDeferAcceptin classSocket
-
getDeferAccept
public boolean getDeferAccept()
- Specified by:
getDeferAcceptin classSocket
-
setReuseAddr
public final void setReuseAddr(boolean reuseAddr, boolean reusePort)- Specified by:
setReuseAddrin classSocket
-
getReuseAddr
public boolean getReuseAddr()
- Specified by:
getReuseAddrin classSocket
-
getReusePort
public boolean getReusePort()
- Specified by:
getReusePortin classSocket
-
setRecvBuffer
public final void setRecvBuffer(int recvBuf)
- Specified by:
setRecvBufferin classSocket
-
getRecvBuffer
public int getRecvBuffer()
- Specified by:
getRecvBufferin classSocket
-
setSendBuffer
public final void setSendBuffer(int sendBuf)
- Specified by:
setSendBufferin classSocket
-
getSendBuffer
public int getSendBuffer()
- Specified by:
getSendBufferin classSocket
-
getOption
public final byte[] getOption(int level, int option)
-
setOption
public final boolean setOption(int level, int option, byte[] value)
-
getLocalAddress
public final java.net.InetSocketAddress getLocalAddress()
- Specified by:
getLocalAddressin classSocket
-
getRemoteAddress
public final java.net.InetSocketAddress getRemoteAddress()
- Specified by:
getRemoteAddressin classSocket
-
sslWrap
public Socket sslWrap(SslContext context)
-
getSslContext
public SslContext getSslContext()
- Specified by:
getSslContextin classSocket
-
getSslOption
public <T> T getSslOption(SslOption<T> option)
- Specified by:
getSslOptionin classSocket
-
getSelectableChannel
public java.nio.channels.SelectableChannel getSelectableChannel()
- Specified by:
getSelectableChannelin classSelectableJavaSocket
-
findReusePortOption
private static java.net.SocketOption<java.lang.Boolean> findReusePortOption()
-
-