CPS 4931 PLTL Workshops
a. In your textbook do problems:
a. Using the Socket API for DatagramSocket and the writeup Example 2 code (Figures 4.10, 4.11, &
4.12) Each student should download
three java files from
to their mydocuments directory.
Both students need a copy of the MyDatagramSocket code to their /CPS4931 directory on eve..
ve one person copy the senderReceiver to their eve /CPS4931 directory..
Have another person on a different machine copy the receiverSender to eve in /CPS4931 directory .
machine SSH to eve and compile the
.java files on each machine.
hen on one machine, start Example2ReceiverSender first, then on the other machine start
Example2SenderReceiver second, using the following commands:
java Example2ReceiverSender eve.kean.edu 20000 10000 studentname1
ver eve.kean.edu 20000 10000 studentname2
Describe the outcome. Be clear what is on each terminal window.
it is happening.
are the two port numbers different?
Try it with all port numbers as 20000.
c. On one machine boot up in Fedora. On that machine, start a local terminal on your PC (not SSH to
to see where you are.
CPS4931 directory where you have the java files from above.
Copy the 2
from that /CPS4931 directory to the local machine’s /tmp directory. (Every
Fedora PC has a /tmp directory on that PC). Then
should show you these 2 files are in your /tmp directory
Then compile the E
xample2SenderReceiver.java and the MyDatagramSocket.java on your local
machine (from the /tmp directory)
In order to run the processes on different machines, one on your machine and one on eve,
First find out the domain name of the localhost PC using t
Then read the comments in the code to know where to put which address in the command line. What
do the two
have to look like?
If nothing works, try reversing the Example2ReceiverSender to eve, and the Example2Sende
to the other machine.
Do the port numbers still need to be different? Try it once with both ports the same 20000 port. What
happens? Why is this different from the first time?
If nothing works, how can you change the code to at least finish more
Then run the two processes on the separate machines both in Fedora. Describe the outcome.
d. Discuss :
1. Why is the order of the execution of the two processes important? What happens if you
execute the SenderReceiver first?
2. How would you
have to change the code so that the ReceiverSender on eve.kean.edu could
be run without knowing which machine the SenderReceiver was on?
(such that the command line arguments on the ReceiverSender does NOT contain the address of the
other SenderReceiver ma
3. Why does the MyDatagramSocket have to be compiled on both your machine and eve?
Read MyDatagramSocket. How would the MyDatagramSocket.java have to be changed in discussion 2
Working in Fedora
1. You are on a PC which has network a
All hosts on the network have the same name
which is called
2. You are running the linux operating system which is very similar to Unix but not identical. This is
why you should compile code on the linux
machine if you are going to run it on the linux machine.
3. In a terminal on your PC you have access to the local directories, such as /tmp as well as the
networked mapped directories on eve.kean.edu which you know as your home directory. When you
a local terminal screen you can see both local directories, such as /tmp, and network mapped
directories on eve.
Your home directory which is /home/student/
is your default directory.
So when you compile and run on the local machine you want the f
iles on the local /tmp directory. So
/tmp is where you will copy the files that you are going to compile or run on the local PC
4. In order to compile and execute on eve, you must ssh to eve in the terminal screen.
When you are in eve you can only see fi
les in your home directories below you, like
/CPS4931 so this is where you will have your .java and .class files for running
programs on eve.
a. Comparing connection oriented to connectionless protocols:
If a message i
s 16K long, and each packet is 1 K message and 128 bytes for addresses and 8 bytes for
checksums 8 bytes for circuit number, and 8 bytes for packet number; and connection needs 10 mills,
how fast must the average data transfer rate be for traffic on connec
tionless to be better choice than
a. In Pairs, Read the code of your application, until you discover which java’s invoke which jsp’s and
visa versa. Be sure to get them all, including the ones you
It calls Shared
It transfers control to Login.jsp thru gotoPage (dispatcher)
It calls Shared
It transfers control to Login.java thru the form action
It calls login method
It calls DBI.java
to check the userid and password
ls the DBI.java to get the employeeI
If userid and password are ok it transfers to mainPage.java (thru dispatcher)
Else transfers control back to Login.jsp(thru dispatcher)
What about all of the others servlets
Complete the chart above