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

DatagramSocketImpl.join incorrectly handles 224.0.0.0; spec is unclear

    XMLWordPrintable

Details

    • kestrel
    • sparc
    • solaris_2.5

    Description



      Name: mgC56079 Date: 08/04/99


      According to the MulticastSocket spec, "A multicast group is specified by a class D
      IP address, those in the range 224.0.0.1 to 239.255.255.255".
      The spec for MulticastSocket.joinGroup(InetAddress) says an IOException will be thrown
      "when the address is not a multicast address".

      There are two problems here:

      1. The method MulticastSocket.joinGroup doesn't throw an exception for invalid address 224.0.0.0.
         (this method simply calls DatagramSocketImpl.join (the actual implementation is in
         PlainDatagramSocketImpl.join)).

      2. The spec for DatagramSocketImpl.join is not consistent with the one of
         MulticastSocket.joinGroup as it says nothing about handling of non-multicast addresses.

      An example demonstrating the problem #1:
      ======== MultiCastTest.java ===========
      import java.net.*;
      class MultiCastTest {

          public static void main(String args[]) throws Exception {
              InetAddress addr = InetAddress.getByName("224.0.0.0");
              MulticastSocket s = new MulticastSocket(3000);
              try {
                  s.joinGroup(addr);
                  System.out.println("failed: IOException expected");
              }
              catch(java.io.IOException e) {
                  System.out.println("passed");
              }
          }

      }

      ======== sample run ===========
      % java MultiCastTest
      failed: IOException expected

      ======================================================================

      Attachments

        Activity

          People

            gellisonsunw Gary Ellison (Inactive)
            gorsunw Gor Gor (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: