Modifier and Type | Class and Description |
---|---|
class |
Inet4Address
This class represents an Internet Protocol version 4 (IPv4) address.
|
class |
Inet6Address
This class represents an Internet Protocol version 6 (IPv6) address.
|
Modifier and Type | Method and Description |
---|---|
InetAddress |
DatagramPacket.getAddress()
Returns the IP address of the machine to which this datagram is being
sent or from which the datagram was received.
|
InetAddress |
InetSocketAddress.getAddress()
Gets the
InetAddress . |
static InetAddress[] |
InetAddress.getAllByName(java.lang.String host)
Given the name of a host, returns an array of its IP addresses,
based on the configured name service on the system.
|
static InetAddress |
InetAddress.getByAddress(byte[] addr)
Returns an
InetAddress object given the raw IP address . |
static InetAddress |
InetAddress.getByAddress(java.lang.String host,
byte[] addr)
Creates an InetAddress based on the provided host name and IP address.
|
static InetAddress |
InetAddress.getByName(java.lang.String host)
Determines the IP address of a host, given the host's name.
|
InetAddress |
ServerSocket.getInetAddress()
Returns the local address of this server socket.
|
InetAddress |
DatagramSocket.getInetAddress()
Returns the address to which this socket is connected.
|
InetAddress |
Socket.getInetAddress()
Returns the address to which the socket is connected.
|
InetAddress |
MulticastSocket.getInterface()
Retrieve the address of the network interface used for
multicast packets.
|
InetAddress |
DatagramSocket.getLocalAddress()
Gets the local address to which the socket is bound.
|
InetAddress |
Socket.getLocalAddress()
Gets the local address to which the socket is bound.
|
static InetAddress |
InetAddress.getLocalHost()
Returns the address of the local host.
|
Modifier and Type | Method and Description |
---|---|
java.util.Enumeration<InetAddress> |
NetworkInterface.getInetAddresses()
Convenience method to return an Enumeration with all or a
subset of the InetAddresses bound to this network interface.
|
Modifier and Type | Method and Description |
---|---|
void |
DatagramSocket.connect(InetAddress address,
int port)
Connects the socket to a remote address for this socket.
|
static NetworkInterface |
NetworkInterface.getByInetAddress(InetAddress addr)
Convenience method to search for a network interface that
has the specified Internet Protocol (IP) address bound to
it.
|
void |
MulticastSocket.joinGroup(InetAddress mcastaddr)
Joins a multicast group.
|
void |
MulticastSocket.leaveGroup(InetAddress mcastaddr)
Leave a multicast group.
|
void |
MulticastSocket.setInterface(InetAddress inf)
Set the multicast network interface used by methods
whose behavior would be affected by the value of the
network interface.
|
Constructor and Description |
---|
DatagramPacket(byte[] buf,
int length,
InetAddress address,
int port)
Constructs a datagram packet for sending packets of length
length to the specified port number on the specified
host. |
DatagramPacket(byte[] buf,
int offset,
int length,
InetAddress address,
int port)
Constructs a datagram packet for sending packets of length
length with offset ioffset to the
specified port number on the specified host. |
DatagramSocket(int port,
InetAddress laddr)
Creates a datagram socket, bound to the specified local
address.
|
InetSocketAddress(InetAddress addr,
int port)
Creates a socket address from an IP address and a port number.
|
ServerSocket(int port,
int backlog,
InetAddress bindAddr)
Create a server with the specified port, listen backlog, and
local IP address to bind to.
|
Socket(InetAddress address,
int port)
Creates a stream socket and connects it to the specified port
number at the specified IP address.
|
Socket(InetAddress address,
int port,
InetAddress localAddr,
int localPort)
Creates a socket and connects it to the specified remote address on
the specified remote port.
|
Socket(java.lang.String host,
int port,
InetAddress localAddr,
int localPort)
Creates a socket and connects it to the specified remote host on
the specified remote port.
|