Вы находитесь на странице: 1из 1

Clayton State University Department of Information Technology

CSCI 3306 Fall 2011

CSCI 3306 Networking and Security


Programming Assignment #2
Assignment Date: October 25, 2011 Submission Due: November 03, 2011

Problem Description: This programming assignment consists of two simple programs: a client and a server. The source code of the programs will be named as client.cs and server.cs. The requirements for both the client and the server are given below: 1. The client program will be a TCP based program written in C# that queries a TCP server at port 14500 on a user-specified remote host. The program must have the following features: o The client program is a single threaded console application that may take up to two command line parameters: a switch (-c) and an IP address of the target machine where the server is located. o When the switch c is provided in command line the client must synchronize its clock with that of the server. An absence of this switch means that no clock synchronization will be done. o When no IP address is provided the client will assume that the server is located in the same machine as the client itself. o The user must be able to specify the remote host's address in the form of its name (in FQDN format) or dotted decimal IP address from the command line. o The client program will send its IP address to server and receive clock time from the server. Based on a command line switch it will set the client computer clock to the clock time it received from the server. Once connected it will display the message Press F12 to terminate. followed by new line and stay connected until F12 key is pressed. After receiving timestamp from the server and processing according to the command parameters the client will print the timestamp it received. 2. The server program is a TCP based program written is C# that binds to the TCP port 14500. It loops indefinitely, accepts connection request from TCP based clients and displays the connection details. It will send the current date-time to the client. The program must have the following features: o The server has no command line parameters. o It will be a multithreaded application that manages each client connection on a separate thread. o The server will display the following message after accepting a client connection Connected with a Client (thread #): which must be followed by the client IP address and the text at followed by the port number. Once a client disconnects the message Client: X disconnected (thread #)!. [Note: # is the thread number and X is the client IP address]. o Once it successfully sends the current date and time to the client the server will display (for example) the following message Sent timestamp on October 25, 2011 at 15:58:00 to 168.28.51.224. o The server program will continue to run indefinitely (CTRL+C on windows to terminate) and accept any new client connection. 3. Do not use any deprecated methods in your program. You must catch for exceptions where appropriate and provide correct feedback. Your code must be free from any build error and must end gracefully without crashing. You will incur heavy penalty if your program crashes due to unhandled exception, etc. Your programs should check for errors at all critical points. If you would like you may add more features to this application but those will not be part of the grading for this assignment).
M. Rahman 10/25/11 Page 1 (1)

Вам также может понравиться