Package | Description |
---|---|
java.net |
Network communication through TCP and UDP sockets or URLs.
|
Modifier and Type | Class and Description |
---|---|
class |
InetSocketAddress
InetSocketAddress instances represent socket addresses in the java.nio
package.
|
Modifier and Type | Method and Description |
---|---|
SocketAddress |
Socket.getLocalSocketAddress()
Returns local socket address.
|
SocketAddress |
ServerSocket.getLocalSocketAddress()
Returns the local socket address
|
SocketAddress |
DatagramSocket.getLocalSocketAddress()
Returns the local SocketAddress this socket is bound to.
|
SocketAddress |
Socket.getRemoteSocketAddress()
Returns the remote socket address.
|
SocketAddress |
DatagramSocket.getRemoteSocketAddress()
Returns the SocketAddress of the host this socket is conneted to or null if
this socket is not connected.
|
SocketAddress |
DatagramPacket.getSocketAddress()
Gets the socket address of the host this packet will be sent to/is coming
from
|
Modifier and Type | Method and Description |
---|---|
void |
Socket.bind(SocketAddress bindpoint)
Binds the socket to the given local address/port
|
void |
ServerSocket.bind(SocketAddress endpoint)
Binds the server socket to a specified socket address
|
void |
DatagramSocket.bind(SocketAddress address)
Binds the socket to the given socket address.
|
void |
ServerSocket.bind(SocketAddress endpoint,
int backlog)
Binds the server socket to a specified socket address
|
void |
Socket.connect(SocketAddress endpoint)
Connects the socket with a remote address.
|
void |
DatagramSocket.connect(SocketAddress address)
Connects the datagram socket to a specified socket address.
|
void |
Socket.connect(SocketAddress endpoint,
int timeout)
Connects the socket with a remote address.
|
void |
DatagramPacket.setSocketAddress(SocketAddress address)
Sets the address of the remote host this package will be sent
|
Constructor and Description |
---|
DatagramPacket(byte[] buf,
int offset,
int length,
SocketAddress address)
Initializes a new instance of
DatagramPacket for transmitting
packets across the network. |
DatagramPacket(byte[] buf,
int length,
SocketAddress address)
Initializes a new instance of
DatagramPacket for transmitting
packets across the network. |
DatagramSocket(SocketAddress address)
Initializes a new instance of
DatagramSocket that binds to the
specified local port and address. |