DatagramSocket.isBound reports 'false' when socket implicitly bound

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 1.4.0
    • Affects Version/s: 1.4.0
    • Component/s: core-libs
    • None
    • beta3
    • generic
    • generic


      DatagramSocket.isBound() reports false if the socket is bound
      implicitly :-

      import java.net.*;

      public class Test {
          public static void main(String args[]) throws Exception {
      DatagramSocket s = new DatagramSocket((SocketAddress)null);
      s.setBroadcast(true);
      byte b[] = "hello".getBytes();
      InetAddress ia = InetAddress.getByName("localhost");
      DatagramPacket pac = new DatagramPacket(b, b.length, ia, 2000);
      s.send(pac);
      if (!isBound()) {
         InetSocketAddress isa = new InetSocketAddress(isa, 3000);
      s.bind(isa);
      }
         }
      }

            Assignee:
            Jean-Christophe Collet (Inactive)
            Reporter:
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: