[SOLVED] CS372 -Project1

30.00 $

Category:

Description

Rate this product

Introduction to Computer Networks                 

Objectives:

  1. Implement a client-server network application
  2. Learn to use the sockets API
  3. Use the TCP protocol
  4. Refresh programming skills

 

The Program:

Design and implement a simple chat system that works for one pair of users, i.e., create two programs: a chat server and a chat client.  The final version of your programs must accomplish the following tasks:

  1. chatserve starts on host A.
  2. chatserve on host A waits on a port (specified by command-line) for a client request.
  3. chatclient starts on host B, specifying host A’s hostname and port number on the command line.
  4. chatclient on host B gets the user’s “handle” by initial query (a one-word name, up to 10 characters). chatclient will display this handle as a prompt on host B, and will prepend it to all messages sent to host A.  g.,  “ SteveO> Hi!!”
  5. chatclient on host B sends an initial message to chatserve on host A : PORTNUM. This causes a connection to be established between Host A and Host B.  Host A and host B are now peers, and may alternate sending and receiving messages.  Responses from host A should have host A’s “handle” prepended.
  6. Host A responds to Host B, or closes the connection with the command “\quit”
  7. Host B responds to Host A, or closes the connection with the command “\quit”
  8. If the connection is not closed, repeat from 6.
  9. If the connection is closed, chatserve repeats from 2 (until a SIGINT is received).

 

 

Notes:

  • For your C implementation, read Beej’s Guide. It has everything you need for this assignment.  You will probably learn the most about socket programming by using C.
  • If you are using Python, check http://docs.python.org/release/2.6.5/library/internet.html,
  • If you are using Java, check http://docs.oracle.com/javase/tutorial/networking/sockets/index.html.
  • It’s OK to hard-code host A’s handle.
  • It’s OK to implement this system so that it requires the two users to take turns sending messages, i.e., when a user sends a message, s/he must wait for a response before sending the next message.
  • When debugging, don’t use the well-known port numbers, because these will already be in use. I’d suggest using 30020 or 30021, though other students may be using these when you’re on the servers.
  • If you use additional include-files or make-files, be sure to include them in your .zip file.
  • You can test these programs using just one computer. Start the server, then start the client in a new window.  You can then switch back and forth between the two terminal windows.