mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8243999: DatagramSocket and MulticastSocket constructors don't specify how a null InetAddress is handled
This fix clarifies the behaviours of constructors from DatagramSocket and MulticastSocket when no address or a null address is supplied. Reviewed-by: dfuchs
This commit is contained in:
parent
c47f27e1c6
commit
ac906168c8
4 changed files with 92 additions and 23 deletions
|
@ -138,8 +138,7 @@ public class DatagramSocket implements java.io.Closeable {
|
|||
/**
|
||||
* Constructs a datagram socket and binds it to any available port
|
||||
* on the local host machine. The socket will be bound to the
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address,
|
||||
* an IP address chosen by the kernel.
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address.
|
||||
*
|
||||
* <p>If there is a security manager,
|
||||
* its {@code checkListen} method is first called
|
||||
|
@ -147,7 +146,7 @@ public class DatagramSocket implements java.io.Closeable {
|
|||
* This could result in a SecurityException.
|
||||
*
|
||||
* @throws SocketException if the socket could not be opened,
|
||||
* or the socket could not bind to the specified local port.
|
||||
* or the socket could not be bound.
|
||||
* @throws SecurityException if a security manager exists and its
|
||||
* {@code checkListen} method doesn't allow the operation.
|
||||
*
|
||||
|
@ -173,7 +172,7 @@ public class DatagramSocket implements java.io.Closeable {
|
|||
* Creates a datagram socket, bound to the specified local
|
||||
* socket address.
|
||||
* <p>
|
||||
* If, if the address is {@code null}, creates an unbound socket.
|
||||
* If the address is {@code null} an unbound socket will be created.
|
||||
*
|
||||
* <p>If there is a security manager,
|
||||
* its {@code checkListen} method is first called
|
||||
|
@ -201,8 +200,7 @@ public class DatagramSocket implements java.io.Closeable {
|
|||
/**
|
||||
* Constructs a datagram socket and binds it to the specified port
|
||||
* on the local host machine. The socket will be bound to the
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address,
|
||||
* an IP address chosen by the kernel.
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address.
|
||||
*
|
||||
* <p>If there is a security manager,
|
||||
* its {@code checkListen} method is first called
|
||||
|
@ -231,9 +229,9 @@ public class DatagramSocket implements java.io.Closeable {
|
|||
* 65535 inclusive. A port number of {@code zero} will let the system pick
|
||||
* up an ephemeral port in a {@code bind} operation.
|
||||
* <p>
|
||||
* If the IP address is 0.0.0.0, the socket will be bound to the
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address,
|
||||
* an IP address chosen by the kernel.
|
||||
* If the IP address is a {@link InetAddress#isAnyLocalAddress wildcard}
|
||||
* address, or is {@code null}, the socket will be bound to the wildcard
|
||||
* address.
|
||||
*
|
||||
* <p>If there is a security manager,
|
||||
* its {@code checkListen} method is first called
|
||||
|
@ -242,7 +240,7 @@ public class DatagramSocket implements java.io.Closeable {
|
|||
* This could result in a SecurityException.
|
||||
*
|
||||
* @param port local port to use in the bind operation.
|
||||
* @param laddr local address to bind
|
||||
* @param laddr local address to bind (can be {@code null})
|
||||
*
|
||||
* @throws SocketException if the socket could not be opened,
|
||||
* or the socket could not bind to the specified local port.
|
||||
|
|
|
@ -147,7 +147,9 @@ public class MulticastSocket extends DatagramSocket {
|
|||
|
||||
|
||||
/**
|
||||
* Create a multicast socket.
|
||||
* Constructs a multicast socket and binds it to any available port
|
||||
* on the local host machine. The socket will be bound to the
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address.
|
||||
*
|
||||
* <p>
|
||||
* If there is a security manager, its {@code checkListen} method is first
|
||||
|
@ -171,7 +173,9 @@ public class MulticastSocket extends DatagramSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a multicast socket and bind it to a specific port.
|
||||
* Constructs a multicast socket and binds it to the specified port
|
||||
* on the local host machine. The socket will be bound to the
|
||||
* {@link InetAddress#isAnyLocalAddress wildcard} address.
|
||||
*
|
||||
* <p>If there is a security manager,
|
||||
* its {@code checkListen} method is first called
|
||||
|
@ -188,6 +192,9 @@ public class MulticastSocket extends DatagramSocket {
|
|||
* while creating the MulticastSocket
|
||||
* @throws SecurityException if a security manager exists and its
|
||||
* {@code checkListen} method doesn't allow the operation.
|
||||
* @throws IllegalArgumentException if port is <a href="DatagramSocket.html#PortRange">
|
||||
* out of range.</a>
|
||||
*
|
||||
* @see SecurityManager#checkListen
|
||||
* @see java.net.DatagramSocket#setReuseAddress(boolean)
|
||||
*/
|
||||
|
@ -196,9 +203,10 @@ public class MulticastSocket extends DatagramSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a MulticastSocket bound to the specified socket address.
|
||||
* Creates a multicast socket, bound to the specified local
|
||||
* socket address.
|
||||
* <p>
|
||||
* Or, if the address is {@code null}, create an unbound socket.
|
||||
* If the address is {@code null} an unbound socket will be created.
|
||||
*
|
||||
* <p>If there is a security manager,
|
||||
* its {@code checkListen} method is first called
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue