public class Socket extends FileDescriptor
限定符和类型 | 字段和说明 |
---|---|
protected boolean |
ipv6 |
static int |
UDS_SUN_PATH_SIZE
已过时。
|
构造器和说明 |
---|
Socket(int fd) |
限定符和类型 | 方法和说明 |
---|---|
int |
accept(byte[] addr) |
void |
bind(java.net.SocketAddress socketAddress) |
boolean |
connect(java.net.SocketAddress socketAddress) |
void |
disconnect() |
boolean |
finishConnect() |
int |
getIntOpt(int level,
int optname) |
void |
getRawOpt(int level,
int optname,
java.nio.ByteBuffer out) |
int |
getReceiveBufferSize() |
int |
getSendBufferSize() |
int |
getSoError() |
int |
getSoLinger() |
int |
getTrafficClass() |
static void |
initialize() |
boolean |
isBroadcast() |
boolean |
isInputShutdown() |
static boolean |
isIPv6Preferred() |
boolean |
isKeepAlive() |
boolean |
isOutputShutdown() |
boolean |
isReuseAddress() |
boolean |
isReusePort() |
boolean |
isShutdown() |
boolean |
isTcpNoDelay() |
void |
listen(int backlog) |
java.net.InetSocketAddress |
localAddress() |
DomainSocketAddress |
localDomainSocketAddress() |
static Socket |
newSocketDgram() |
protected static int |
newSocketDgram0() |
protected static int |
newSocketDgram0(boolean ipv6) |
protected static int |
newSocketDgram0(InternetProtocolFamily family) |
static Socket |
newSocketDomain() |
protected static int |
newSocketDomain0() |
static Socket |
newSocketDomainDgram() |
protected static int |
newSocketDomainDgram0() |
static Socket |
newSocketStream() |
protected static int |
newSocketStream0() |
protected static int |
newSocketStream0(boolean ipv6) |
protected static int |
newSocketStream0(InternetProtocolFamily protocol) |
int |
recv(java.nio.ByteBuffer buf,
int pos,
int limit) |
int |
recvAddress(long address,
int pos,
int limit) |
int |
recvFd() |
DatagramSocketAddress |
recvFrom(java.nio.ByteBuffer buf,
int pos,
int limit) |
DatagramSocketAddress |
recvFromAddress(long memoryAddress,
int pos,
int limit) |
DomainDatagramSocketAddress |
recvFromAddressDomainSocket(long memoryAddress,
int pos,
int limit) |
DomainDatagramSocketAddress |
recvFromDomainSocket(java.nio.ByteBuffer buf,
int pos,
int limit) |
java.net.InetSocketAddress |
remoteAddress() |
DomainSocketAddress |
remoteDomainSocketAddress() |
int |
send(java.nio.ByteBuffer buf,
int pos,
int limit) |
int |
sendAddress(long address,
int pos,
int limit) |
int |
sendFd(int fdToSend) |
int |
sendTo(java.nio.ByteBuffer buf,
int pos,
int limit,
java.net.InetAddress addr,
int port) |
int |
sendTo(java.nio.ByteBuffer buf,
int pos,
int limit,
java.net.InetAddress addr,
int port,
boolean fastOpen) |
int |
sendToAddress(long memoryAddress,
int pos,
int limit,
java.net.InetAddress addr,
int port) |
int |
sendToAddress(long memoryAddress,
int pos,
int limit,
java.net.InetAddress addr,
int port,
boolean fastOpen) |
int |
sendToAddressDomainSocket(long memoryAddress,
int pos,
int limit,
byte[] path) |
int |
sendToAddresses(long memoryAddress,
int length,
java.net.InetAddress addr,
int port) |
int |
sendToAddresses(long memoryAddress,
int length,
java.net.InetAddress addr,
int port,
boolean fastOpen) |
int |
sendToAddressesDomainSocket(long memoryAddress,
int length,
byte[] path) |
int |
sendToDomainSocket(java.nio.ByteBuffer buf,
int pos,
int limit,
byte[] path) |
void |
setBroadcast(boolean broadcast) |
void |
setIntOpt(int level,
int optname,
int optvalue) |
void |
setKeepAlive(boolean keepAlive) |
void |
setRawOpt(int level,
int optname,
java.nio.ByteBuffer optvalue) |
void |
setReceiveBufferSize(int receiveBufferSize) |
void |
setReuseAddress(boolean reuseAddress) |
void |
setReusePort(boolean reusePort) |
void |
setSendBufferSize(int sendBufferSize) |
void |
setSoLinger(int soLinger) |
void |
setTcpNoDelay(boolean tcpNoDelay) |
void |
setTrafficClass(int trafficClass) |
static boolean |
shouldUseIpv6(InternetProtocolFamily family) |
void |
shutdown() |
void |
shutdown(boolean read,
boolean write) |
java.lang.String |
toString() |
protected static boolean |
useIpv6(Socket socket,
java.net.InetAddress address)
Returns
true if the given socket and address combination should use IPv6 internally,
false otherwise. |
close, equals, from, from, hashCode, intValue, isOpen, markClosed, pipe, read, readAddress, write, writeAddress, writev, writevAddresses
@Deprecated public static final int UDS_SUN_PATH_SIZE
protected final boolean ipv6
protected static boolean useIpv6(Socket socket, java.net.InetAddress address)
true
if the given socket and address combination should use IPv6 internally,
false
otherwise.public final void shutdown() throws java.io.IOException
java.io.IOException
public final void shutdown(boolean read, boolean write) throws java.io.IOException
java.io.IOException
public final boolean isShutdown()
public final boolean isInputShutdown()
public final boolean isOutputShutdown()
public final int sendTo(java.nio.ByteBuffer buf, int pos, int limit, java.net.InetAddress addr, int port) throws java.io.IOException
java.io.IOException
public final int sendTo(java.nio.ByteBuffer buf, int pos, int limit, java.net.InetAddress addr, int port, boolean fastOpen) throws java.io.IOException
java.io.IOException
public final int sendToDomainSocket(java.nio.ByteBuffer buf, int pos, int limit, byte[] path) throws java.io.IOException
java.io.IOException
public final int sendToAddress(long memoryAddress, int pos, int limit, java.net.InetAddress addr, int port) throws java.io.IOException
java.io.IOException
public final int sendToAddress(long memoryAddress, int pos, int limit, java.net.InetAddress addr, int port, boolean fastOpen) throws java.io.IOException
java.io.IOException
public final int sendToAddressDomainSocket(long memoryAddress, int pos, int limit, byte[] path) throws java.io.IOException
java.io.IOException
public final int sendToAddresses(long memoryAddress, int length, java.net.InetAddress addr, int port) throws java.io.IOException
java.io.IOException
public final int sendToAddresses(long memoryAddress, int length, java.net.InetAddress addr, int port, boolean fastOpen) throws java.io.IOException
java.io.IOException
public final int sendToAddressesDomainSocket(long memoryAddress, int length, byte[] path) throws java.io.IOException
java.io.IOException
public final DatagramSocketAddress recvFrom(java.nio.ByteBuffer buf, int pos, int limit) throws java.io.IOException
java.io.IOException
public final DatagramSocketAddress recvFromAddress(long memoryAddress, int pos, int limit) throws java.io.IOException
java.io.IOException
public final DomainDatagramSocketAddress recvFromDomainSocket(java.nio.ByteBuffer buf, int pos, int limit) throws java.io.IOException
java.io.IOException
public final DomainDatagramSocketAddress recvFromAddressDomainSocket(long memoryAddress, int pos, int limit) throws java.io.IOException
java.io.IOException
public int recv(java.nio.ByteBuffer buf, int pos, int limit) throws java.io.IOException
java.io.IOException
public int recvAddress(long address, int pos, int limit) throws java.io.IOException
java.io.IOException
public int send(java.nio.ByteBuffer buf, int pos, int limit) throws java.io.IOException
java.io.IOException
public int sendAddress(long address, int pos, int limit) throws java.io.IOException
java.io.IOException
public final int recvFd() throws java.io.IOException
java.io.IOException
public final int sendFd(int fdToSend) throws java.io.IOException
java.io.IOException
public final boolean connect(java.net.SocketAddress socketAddress) throws java.io.IOException
java.io.IOException
public final boolean finishConnect() throws java.io.IOException
java.io.IOException
public final void disconnect() throws java.io.IOException
java.io.IOException
public final void bind(java.net.SocketAddress socketAddress) throws java.io.IOException
java.io.IOException
public final void listen(int backlog) throws java.io.IOException
java.io.IOException
public final int accept(byte[] addr) throws java.io.IOException
java.io.IOException
public final java.net.InetSocketAddress remoteAddress()
public final DomainSocketAddress remoteDomainSocketAddress()
public final java.net.InetSocketAddress localAddress()
public final DomainSocketAddress localDomainSocketAddress()
public final int getReceiveBufferSize() throws java.io.IOException
java.io.IOException
public final int getSendBufferSize() throws java.io.IOException
java.io.IOException
public final boolean isKeepAlive() throws java.io.IOException
java.io.IOException
public final boolean isTcpNoDelay() throws java.io.IOException
java.io.IOException
public final boolean isReuseAddress() throws java.io.IOException
java.io.IOException
public final boolean isReusePort() throws java.io.IOException
java.io.IOException
public final boolean isBroadcast() throws java.io.IOException
java.io.IOException
public final int getSoLinger() throws java.io.IOException
java.io.IOException
public final int getSoError() throws java.io.IOException
java.io.IOException
public final int getTrafficClass() throws java.io.IOException
java.io.IOException
public final void setKeepAlive(boolean keepAlive) throws java.io.IOException
java.io.IOException
public final void setReceiveBufferSize(int receiveBufferSize) throws java.io.IOException
java.io.IOException
public final void setSendBufferSize(int sendBufferSize) throws java.io.IOException
java.io.IOException
public final void setTcpNoDelay(boolean tcpNoDelay) throws java.io.IOException
java.io.IOException
public final void setSoLinger(int soLinger) throws java.io.IOException
java.io.IOException
public final void setReuseAddress(boolean reuseAddress) throws java.io.IOException
java.io.IOException
public final void setReusePort(boolean reusePort) throws java.io.IOException
java.io.IOException
public final void setBroadcast(boolean broadcast) throws java.io.IOException
java.io.IOException
public final void setTrafficClass(int trafficClass) throws java.io.IOException
java.io.IOException
public void setIntOpt(int level, int optname, int optvalue) throws java.io.IOException
java.io.IOException
public void setRawOpt(int level, int optname, java.nio.ByteBuffer optvalue) throws java.io.IOException
java.io.IOException
public int getIntOpt(int level, int optname) throws java.io.IOException
java.io.IOException
public void getRawOpt(int level, int optname, java.nio.ByteBuffer out) throws java.io.IOException
java.io.IOException
public static boolean isIPv6Preferred()
public static boolean shouldUseIpv6(InternetProtocolFamily family)
public java.lang.String toString()
toString
在类中 FileDescriptor
public static Socket newSocketStream()
public static Socket newSocketDgram()
public static Socket newSocketDomain()
public static Socket newSocketDomainDgram()
public static void initialize()
protected static int newSocketStream0()
protected static int newSocketStream0(InternetProtocolFamily protocol)
protected static int newSocketStream0(boolean ipv6)
protected static int newSocketDgram0()
protected static int newSocketDgram0(InternetProtocolFamily family)
protected static int newSocketDgram0(boolean ipv6)
protected static int newSocketDomain0()
protected static int newSocketDomainDgram0()