Hi Mark,

The test has a potential problem,  that is the  socket close can
cause the attempted send from server socket to client not to occur.

the sock.send() can result in the application data being copied into the
kernel and queued for sending.  But the send may not take place immediately.
The data may not yet be sent when immediate close()
is executed causing the socket's buffers and data to be released without sending.

lines 24 etc
           DatagramSocket sock = recreateServerSocket(serverPort);
            b = "Greetings from the server".getBytes();
            packet = new DatagramPacket(b, b.length, addr, clientPort);
            sock.send(packet);
            sock.close();

placing a small delay before the close appears to allow the send to take place
           DatagramSocket sock = recreateServerSocket(serverPort);
            b = "Greetings from the server".getBytes();
            packet = new DatagramPacket(b, b.length, addr, clientPort);
            sock.send(packet);
            Thread.sleep(1000);
            sock.close();

Thanks for the insight. I wasn't able to observe the SocketTimeout on Windows but that sounds reasonable. I added a Thread.sleep(1000) before sock.close().

Updated webrev: http://cr.openjdk.java.net/~jboes/webrevs/8232513/webrev.01/

Best,

Julia

Reply via email to