软件包 | 描述 |
---|---|
java.net |
为实现网络应用程序提供类。
|
java.nio.channels |
定义了渠道,它代表的是能够执行I/O操作的实体连接,如文件和套接字;定义选择器,多路复用,非阻塞I/O操作。
|
Modifier and Type | Class and Description |
---|---|
class |
InetSocketAddress
该类实现了IP套接字地址(IP地址+端口号)它也可以是一对(主机名+端口号),在这种情况下,将尝试解析主机名。
|
Modifier and Type | Method and Description |
---|---|
SocketAddress |
Proxy.address()
返回代理的套接字地址,或
null 如果直接连接。
|
SocketAddress |
ServerSocket.getLocalSocketAddress()
返回此套接字绑定到的端点的地址。
|
SocketAddress |
DatagramSocket.getLocalSocketAddress()
返回此套接字绑定到的端点的地址。
|
SocketAddress |
Socket.getLocalSocketAddress()
返回此套接字绑定到的端点的地址。
|
SocketAddress |
DatagramSocket.getRemoteSocketAddress()
返回此套接字连接的端点的地址,或如果它是无关的
null 。
|
SocketAddress |
Socket.getRemoteSocketAddress()
返回此套接字连接的端点的地址,或如果它是无关的
null 。
|
SocketAddress |
DatagramPacket.getSocketAddress()
获取SocketAddress(通常是IP地址+端口号)的远程主机,数据包被发送到或来自。
|
Modifier and Type | Method and Description |
---|---|
void |
ServerSocket.bind(SocketAddress endpoint)
ServerSocket 绑定到一个特定的地址(IP地址和端口号)。
|
void |
DatagramSocket.bind(SocketAddress addr)
结合这个DatagramSocket到特定的地址和端口。
|
void |
Socket.bind(SocketAddress bindpoint)
将套接字绑定到本地地址。
|
void |
ServerSocket.bind(SocketAddress endpoint, int backlog)
ServerSocket 绑定到一个特定的地址(IP地址和端口号)。
|
void |
DatagramSocket.connect(SocketAddress addr)
将此套接字连接到远程套接字地址(IP地址+端口号)。
|
void |
Socket.connect(SocketAddress endpoint)
将此套接字连接到服务器。
|
protected abstract void |
SocketImpl.connect(SocketAddress address, int timeout)
将此套接字连接到指定主机上的指定端口号。
|
void |
Socket.connect(SocketAddress endpoint, int timeout)
将此套接字与指定的超时值连接到服务器。
|
abstract void |
ProxySelector.connectFailed(URI uri, SocketAddress sa, IOException ioe)
调用来表示无法建立到代理服务器/袜子服务器的连接。
|
void |
MulticastSocket.joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
在指定的接口中加入指定的多播组。
|
protected abstract void |
DatagramSocketImpl.joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
加入多播组。
|
void |
MulticastSocket.leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
在指定的本地接口上留下多播组。
|
protected abstract void |
DatagramSocketImpl.leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
离开组播组。
|
void |
DatagramPacket.setSocketAddress(SocketAddress address)
集SocketAddress(通常是IP地址+端口号)的远程主机的数据报发送。
|
Constructor and Description |
---|
DatagramPacket(byte[] buf, int offset, int length, SocketAddress address)
发送有偏置
ioffset to指定端口号指定主机上的数据包长度
length 数据报包结构。
|
DatagramPacket(byte[] buf, int length, SocketAddress address)
指定主机上的指定端口发送数据包的长度
length 数据报包结构。
|
DatagramSocket(SocketAddress bindaddr)
创建一个数据报套接字,绑定到指定的本地套接字地址。
|
MulticastSocket(SocketAddress bindaddr)
创建一个多播套接字绑定到指定的套接字地址。
|
Proxy(Proxy.Type type, SocketAddress sa)
创建一个表示代理连接的条目。
|
Modifier and Type | Method and Description |
---|---|
abstract SocketAddress |
SocketChannel.getLocalAddress()
返回此通道的套接字绑定到的套接字地址。
|
abstract SocketAddress |
AsynchronousSocketChannel.getLocalAddress()
返回此通道的套接字绑定到的套接字地址。
|
abstract SocketAddress |
AsynchronousServerSocketChannel.getLocalAddress()
返回此通道的套接字绑定到的套接字地址。
|
abstract SocketAddress |
DatagramChannel.getLocalAddress()
返回此通道的套接字绑定到的套接字地址。
|
abstract SocketAddress |
ServerSocketChannel.getLocalAddress()
返回此通道的套接字绑定到的套接字地址。
|
SocketAddress |
NetworkChannel.getLocalAddress()
返回此通道的套接字绑定到的套接字地址。
|
abstract SocketAddress |
SocketChannel.getRemoteAddress()
返回此通道的套接字连接的远程地址。
|
abstract SocketAddress |
AsynchronousSocketChannel.getRemoteAddress()
返回此通道的套接字连接的远程地址。
|
abstract SocketAddress |
DatagramChannel.getRemoteAddress()
返回此通道的套接字连接的远程地址。
|
abstract SocketAddress |
DatagramChannel.receive(ByteBuffer dst)
接收数据报通过这个渠道。
|
Modifier and Type | Method and Description |
---|---|
abstract SocketChannel |
SocketChannel.bind(SocketAddress local) |
abstract AsynchronousSocketChannel |
AsynchronousSocketChannel.bind(SocketAddress local) |
AsynchronousServerSocketChannel |
AsynchronousServerSocketChannel.bind(SocketAddress local)
结合通道的插座到本地地址和配置套接字监听连接。
|
abstract DatagramChannel |
DatagramChannel.bind(SocketAddress local) |
ServerSocketChannel |
ServerSocketChannel.bind(SocketAddress local)
结合通道的插座到本地地址和配置套接字监听连接。
|
NetworkChannel |
NetworkChannel.bind(SocketAddress local)
将信道的套接字绑定到本地地址。
|
abstract AsynchronousServerSocketChannel |
AsynchronousServerSocketChannel.bind(SocketAddress local, int backlog)
结合通道的插座到本地地址和配置套接字监听连接。
|
abstract ServerSocketChannel |
ServerSocketChannel.bind(SocketAddress local, int backlog)
结合通道的插座到本地地址和配置套接字监听连接。
|
abstract boolean |
SocketChannel.connect(SocketAddress remote)
连接这个通道的插座。
|
abstract Future<Void> |
AsynchronousSocketChannel.connect(SocketAddress remote)
连接此通道。
|
abstract DatagramChannel |
DatagramChannel.connect(SocketAddress remote)
连接这个通道的插座。
|
abstract <A> void |
AsynchronousSocketChannel.connect(SocketAddress remote, A attachment, CompletionHandler<Void,? super A> handler)
连接此通道。
|
static SocketChannel |
SocketChannel.open(SocketAddress remote)
打开一个套接字通道,并将其连接到远程地址。
|
abstract int |
DatagramChannel.send(ByteBuffer src, SocketAddress target)
将数据报通过这个渠道。
|
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.