CS320 Computer Networks

Assignment 1

Week beginning Jan 31 2000

Mr. John Mc Donald

Objective : The objective of this practical is to introduce the student to the use of sockets for networked inter-process communication (IPC).

Procedure:

Step 1. Read through the handout given to you. If you do not understand any part of it you should ask the demonstrator

Step 2. Download hangserver.c program and the words file from

www.cs.may.ie/~johnmcd/cs320/labs/hangman/hangserver.c

www.cs.may.ie/~johnmcd/cs320/labs/hangman/words

Step 2a. Place both files in your networkslab directory and compile the server using

gcc –o hangserver hangserver.c -lsocket

Step 3. Step through each line of code in the server and try and understand what each one does

Step 4. Using comments explain your understanding of each line of code.

Step 5. Open a terminal window on your machine

Step 6. Run the hangman server

Step 7. Run netstat to verify that your server is running and listening on port 1066

Step 8. Open another terminal window and telnet to your own machine at port 1066

telnet machine_name port

e.g. telnet localhost 1066

Step 9. Document what happens (i.e. on the screen, and in terms of network sockets)

Step 10. Find out your neighbour’s machine name and telnet to their machine at port 1066

Step 11. Get you neighbour to monitor the connection using netstat –a

Step 12. Print out your commented code

Step 13. Hand up both your code and your write up from Step 9. to the demonstrator