Repeat the last step, but add a delay of 3 seconds between iterations in the sender (so that the sender will wait for 3 seconds before sending another message to the receiver). Capture a significant portion of the output. Describe and explain the order of the messages received by the receiver.
This exercise guides you through experiments with connectionless datagram socket via code sample Example1. As a start, it is recommended that you run both programs on one machine, the host name of which you may refer to as “localhost”, as in the command “java Example1Sender localhost 12345 hello” to execute Example1Sender. You may optionally repeat the exercises by running the programs on separate machines, assuming that you have access to such machines.
The code change in the receiver is as follows:
```
while (true) {
byte[ ] buffer = message.getBytes( );
DatagramPacket datagram =
new DatagramPacket(buffer, buffer.length,
receiverHost, receiverPort);
mySocket.send(datagram);
Thread.sleep(3000);
} // end while
```
The output of the messages are interleaved. The senders essentially takes turns in sending messages to the same datagram socket on the receiver:
message1
message2
message1
message2
…
You might also like to view...
It is often difficult to get complete management buy-in to a disaster recovery plan because the ________ associated with the cost of developing the plan and securing the necessary resources is rarely realized
Fill in the blank(s) with correct word
How does software configuration management differ for Web and Mobile Apps?
What will be an ideal response?
IEEE 802.11 WLANs have more collisions than wired Ethernet networks.
Answer the following statement true (T) or false (F)
The following pseudocode is an example of ____.if conditionA is true then do stepEelse do stepB do stepC do stepDendif
A. nesting B. stacking C. a posttest D. a pretest