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

Cannot open a socket with a broadcast address on Win32

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.1.3
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description

      On a Win32 machine, a socket with InetAddress as a broadcast address cannot be opened. By broadcast address, I mean one of type say "129.144.251.255", i.e. a subnet broadcast with all bits reserved for host addresses set to 1.
      This was tested simply using DatagramSocket(port, InetAddress) with above address when machine was on the 251 subnet.
      The same test works fine on Solaris. The creation of the socket results in an exception.
      The exception received is java.net.BindException with message
      Test program:

      import java.net.*;
      import java.lang.*;


      public class test {
          DatagramSocket sock = null;
          InetAddress addr;
          public static void main(String[] args){
              new test();
          }
          
          public test(){
              try{
                  addr = InetAddress.getByName("129.144.251.255");
                      System.err.println("address is " + addr.toString());
                  sock = new DatagramSocket(49152, addr);
                  System.out.println("sock is " + sock);
              }catch (Exception e){
                  System.err.println("exception " + e.getMessage() + e );
              }
          }
      }

      "Cannot assign requested address".

        Attachments

          Activity

            People

            Assignee:
            mmcclosksunw Michael Mccloskey (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: