Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243999

DatagramSocket and MulticastSocket constructors don't specify how a null InetAddress is handled

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 15
    • 15
    • core-libs
    • b27

      The constructor:
          public DatagramSocket(int port, InetAddress laddr) throws SocketException {
              this(new InetSocketAddress(laddr, port));
          }

      relies on `InetSocketAddress(laddr, port)` whose specification states "A null address will assign the wildcard address". A similar assertion should be added to the specification of `DatagramSocket(int port, InetAddress laddr)` to clarify what occurs when a null address is passed as a parameter. This is also true for `MulticastSocket(SocketAddress bindaddr)`.

      The constructor:
          public DatagramSocket(int port) throws SocketException {
              this(port, null);
          }

      mentions "The socket will be bound to the wildcard address, an IP address chosen by the kernel". This is ambiguous and requires clarification.

            pconcannon Patrick Concannon (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: