Lab01 : Accounts; compile and test echo server
Data due
Jan 19th (01/19/2019) 11:59 pm.
Learning objective
- Setup account
- Compile echo server and client
- Test echo server and client in same machine
- Test echo server and client in remote machine
Introduction
In the first lab, you will be learning how to setup your accounts, use ssh to remotely connect to one of the Xinu machines, download and compile test echo server.
Echo server is a server that receives messages from a client and returns the same message back to the client. It is used to test whether connection is established between two computers and whether it can send and receive messages correctly.
We will use simplified Application Programming Interface(API) dedicated to write such application. Further details about the API is described in textbook - Appendix 1.
Note: For this lab you should use the port number that is assigned to you. If you haven't received an email about that, please contact the TAs.
Instructions
- To connect to a remote system:
ssh [Put Purdue Account Name Here]@[Put Target Computer Here]
- For example:arastega@xinu1.cs.purdue.edu
- Note: Target computer should be one of the xinu machines (xinu01-xinu21)
- Prompts you for your Password
- Once verified, you gain access to the remote system
- Open the terminal and type in the following commands to create lab directory for the semester:
mkdir -p ~/cs422/
- Download lab01.tar.gz with
wget
under~/cs422/
. Note that option '-O' is capitalized.
cd ~/cs422/ wget http://courses.cs.purdue.edu/_media/cs42200:spring19:lab01.tar.gz -O lab01.tar.gz
- Unzip the downloaded file.
tar xvf lab01.tar.gz
- Now, compile
echoserver
andechoclient
withmake
command.
cd ~/cs422/lab01/compile_linux make
Test your server in localhost
- First, we will test
echoserver
in localhost. When runningechoserver
, you must provide application number(=port number) which should be unique to all students. Please consult with TA if you have not yet assigned an application number. This application number will be used for the whole semester, so write it down somewhere and don't forget it.
./echoserver YOUR_APPLICATION_NUMBER
- If the echo server immediately crashes, it means someone's already using your application number. Try with different number.
- Open up another terminal and run
echoclient
to connect toechoserver
. (Note: you need to make a new ssh connection to the current xinu machine that the server is running)
cd ~/cs422/lab01/compile_linux ./echoclient localhost YOUR_APPLICATION_NUMBER
- Now you can test how echo server “echos” your input. Test with various texts.
Input > test Received> test Input > hello world Received> hello world Input >
- You can quit the echo client with “Ctrl+C” or “Ctrl+D”.
Test your server in remotehost
- Open up a new terminal for the remote ssh session to Xinu machines. Then, ssh into one of Xinu machine. To prevent Xinu server overloaded, try to use your last 1 digit of Purdue student ID for server name. If you have '7' for your last 1 digit, try using “xinu07” instead of “xinu01”.
ssh [Put Purdue Account Name Here]@[xinu[01-021].cs.purdue.edu]
- Compile
echoserver
.
cd ~/cs422/lab01 cd compile_linux make echoserver
- Run the echo server.
./echoserver YOUR_APPLICATION_NUMBER
- Now, try to connect to the remote echo server from your local echo client. Open up a new terminal and do:
cd ~/cs422/lab01/compile_linux ./echoclient YOUR_XINU_MACHINE_NAME YOUR_APPLICATION_NUMBER
- You may be able to see echo server returns string whatever you typed.
Lab Report
Note: For the lab report, you should include a screenshot of the echo server and client running on different machines. Please place the PDF in the ~/cs422/lab01 folder and name it lab01.pdf.
Turn-in your work
You should use turnin
command to submit your whole directory.
cd ~/cs422 turnin -c cs422 -p lab01 lab01
You can check with turnin -v.
turnin -c cs422 -p lab01 -v
Grading
Grading Rubric (tentative) | Points |
---|---|
Downloaded and untarred the file(s) with the API and echo app | 5 |
Compiled the echo client and server | 5 |
Successfully ran the echo server on one computer and the client on another | 5 |
Submit your works with turnin | 5 |
Data due
Jan 19th (01/19/2019) 11:59 pm.