Package | Description |
---|---|
java.net |
Modifier and Type | Class and Description |
---|---|
class |
InetSocketAddress
This class implements an IP Socket Address (IP address + port number) It can also be a pair (hostname + port number),
in which case an attempt will be made to resolve the hostname.
|
Modifier and Type | Method and Description |
---|---|
SocketAddress |
Socket.getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to.
|
SocketAddress |
ServerSocket.getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to.
|
SocketAddress |
DatagramSocket.getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to.
|
SocketAddress |
Socket.getRemoteSocketAddress()
Returns the address of the endpoint this socket is connected to, or
null if it is unconnected. |
SocketAddress |
DatagramSocket.getRemoteSocketAddress()
Returns the address of the endpoint this socket is connected to, or
null if it is unconnected. |
SocketAddress |
DatagramPacket.getSocketAddress()
Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or
is coming from.
|
Modifier and Type | Method and Description |
---|---|
void |
Socket.bind(SocketAddress bindpoint)
Binds the socket to a local address.
|
void |
ServerSocket.bind(SocketAddress endpoint)
Binds the
ServerSocket to a specific address (IP address and port number). |
void |
DatagramSocket.bind(SocketAddress addr)
Binds this DatagramSocket to a specific address and port.
|
void |
ServerSocket.bind(SocketAddress endpoint,
int backlog)
Binds the
ServerSocket to a specific address (IP address and port number). |
void |
Socket.connect(SocketAddress endpoint)
Connects this socket to the server.
|
void |
DatagramSocket.connect(SocketAddress addr)
Connects this socket to a remote socket address (IP address + port number).
|
void |
Socket.connect(SocketAddress endpoint,
int timeout)
Connects this socket to the server with a specified timeout value.
|
void |
MulticastSocket.joinGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
Joins the specified multicast group at the specified interface.
|
void |
MulticastSocket.leaveGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
Leave a multicast group on a specified local interface.
|
void |
DatagramPacket.setSocketAddress(SocketAddress address)
Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being
sent.
|
Constructor and Description |
---|
DatagramPacket(byte[] buf,
int offset,
int length,
SocketAddress address)
Constructs a datagram packet for sending packets of length
length with offset ioffset to the
specified port number on the specified host. |
DatagramPacket(byte[] buf,
int length,
SocketAddress address)
Constructs a datagram packet for sending packets of length
length to the specified port number on the
specified host. |
DatagramSocket(SocketAddress bindaddr)
Creates a datagram socket, bound to the specified local socket address.
|
MulticastSocket(SocketAddress bindaddr)
Create a MulticastSocket bound to the specified socket address.
|