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

(so) DatagramChannel receive() does not return null when no datagrams avail, nb

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • beta3
    • generic
    • generic
    • Verified


      In non-blocking mode, both Solaris and Linux throw
      "SocketException: Resource temporarily unavailable"
      when attempting to read from a datagram channel
      where no datagrams are available.

      On Windows (2000/98) receive() returns null per spec.

      excerpt:

          try {
          DatagramChannel socket1 = DatagramChannel.open(5441);
          socket1.configureBlocking(false);
          ByteBuffer buf1 = ByteBuffer.allocateDirect(256);
          
          // receive request (nothing sent)
          
           SocketAddress sa1 = socket1.receive(buf1);
           System.out.println("Good! No Exception thrown");
           System.out.println("Value of sa1 = " + sa1);
          } catch (Exception e1) {
      System.out.println ("Failed - exception thrown = " + e1);
          }


      Test attached.

            mmcclosksunw Michael Mccloskey (Inactive)
            kpolomsksunw Krystyna Polomski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: