cs42200:spring19:labs:lab01

Lab01 : Accounts; compile and test echo server

Jan 19th (01/19/2019) 11:59 pm.

  1. Setup account
  2. Compile echo server and client
  3. Test echo server and client in same machine
  4. Test echo server and client in remote machine

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.

  1. To connect to a remote system: ssh [Put Purdue Account Name Here]@[Put Target Computer Here]
    1. For example:arastega@xinu1.cs.purdue.edu
    2. Note: Target computer should be one of the xinu machines (xinu01-xinu21)
  2. Prompts you for your Password
  3. Once verified, you gain access to the remote system
  4. Open the terminal and type in the following commands to create lab directory for the semester:
    mkdir -p ~/cs422/
  5. 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
  6. Unzip the downloaded file.
    tar xvf lab01.tar.gz
  7. Now, compile echoserver and echoclient with make command.
    cd ~/cs422/lab01/compile_linux
    make
  1. First, we will test echoserver in localhost. When running echoserver, 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
  2. If the echo server immediately crashes, it means someone's already using your application number. Try with different number.
  3. Open up another terminal and run echoclient to connect to echoserver. (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
  4. 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   >
  5. You can quit the echo client with “Ctrl+C” or “Ctrl+D”.
  1. 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]
  2. Compile echoserver.
    cd ~/cs422/lab01
    cd compile_linux
    make echoserver
  3. Run the echo server.
    ./echoserver YOUR_APPLICATION_NUMBER
  4. 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
  5. You may be able to see echo server returns string whatever you typed.

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.

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 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

Jan 19th (01/19/2019) 11:59 pm.

  • cs42200/spring19/labs/lab01.txt
  • Last modified: 2019/01/12 09:55
  • by arastega