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

Connection becomes refused after first DatagramServerSocket.send() call

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description



      Name: iaR10016 Date: 04/26/2000



      JDK version:
      java version "1.3.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b01)
      Classic VM (build 1.3.0beta-b01, green threads, nojit)

      Connection becomes refused after the first DatagramServerSocket.send() call in Linux JDK 1.3.,
      and if you send DatagramPacket once more, IO Exception is thrown.
      It Solaris JDK 1.3 this bug is absent.

      The following test example creates DatagramSocket object and DatagramPacket object, and then send
      the packet twice:

      --------------------------------------test.java:----------------------------------------------------------------

      import java.net.*;
       
      public class test {
          public static void main( String[] sss) {
              try {
                  String msg = "Hello, World!";
                  InetAddress me = InetAddress.getByName("127.0.0.1");
                  DatagramSocket s = new DatagramSocket(3456,me);
                  DatagramPacket hi = new DatagramPacket(msg.getBytes(),msg.length(),me,4567);
                  s.send(hi);
                  System.out.println("Message was sent - 1");
                  s.send(hi);
                  System.out.println("Message was sent - 2");
              } catch (Exception e) {
                  System.out.println(e);
              }
          }
      }

      ...

      Output of the test in Linux OS:

      ...

      $ javac test.java
      $ java test
      Message was sent - 1
      java.io.IOException: Connection refused

      ...

      Output of the test in Solaris OS:

      ...
      $ javac test.java
      $ java test
      Message was sent - 1
      Message was sent - 2
        
      ...

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              irasunw Ira Ira (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: