


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Part 1(worth 25%). Short Answer (Answer all 6 questions)
Show all work to receive partial credit. Note: You must do these questions by yourself (NOT with your partner of Part 2). You are required to use a word processing program to write your answers to homework assignments in this class (submissions should be in PDF). Whenever something is unclear in the question, form assumptions, and make those assumptions explicit in your answers. In all answers, be as specific as possible. Limit your answer to each question or each part of a question to a maximum of approximately 1/4 page.
Part 2 (worth 75%). Programming Assignment (IM via sockets)
You are encouraged to do this assignment with one other person from our class. You can do this assignment by yourself if you wish.
The purpose of this assignment is to gain experience using TCP and sockets using C/C++ on Linux (you must use C/C++ ; you may also use Cygwin – http://www.cygwin.com). You are to create a client for
our version of the “Instant Messaging” (IM) that is so prevalent in today’s Internet use. It is assumed in this assignment that everyone is familiar with the basic mechanisms of IM – if not, please see http://en.wikipedia.org/wiki/Instant_messaging
Note that our version will be a little primitive, because we are interested in gaining experience with low- level programming (sockets) and we’re not really interested (at this point in the class) in the graphical aspects. Also, because “operating systems” is a co-requisite, this assignment is going to assume that you may not have learned multi-threaded programming (yet).
You are to create three programs:
IM_Register: This program should be invoked only once, to register yourself with a central server (which we will run for you). This central server will keep track of your network location and the time at which you last “logged in”. There are four command-line arguments: directory- server-hostname directory-server-port username password. IM_Listen: Run this program to authenticate (“login”) to the central server and then sit there waiting for others wanting to talk with you. There are five arguments: directory-server-hostname directory-server-port username password portnumber (the portnumber you are listening on). IM_Chat: First, this program authenticates to the central server, then this program requests a list of active clients (those who have “listen”-ed recently). This program should then prompt the user for whom to attempt to connect to. If a connection can be made, then this program should facilitate a dialogue with the other party. Once this dialogue is complete, this program should terminate. There are four command-line arguments: directory-server-hostname directory-server- port username password.
Upon completion, your normal operation should be to run “IM_Listen” in one window, and “IM_Chat” in another window. You can test your code by asking specific other teams or by finding a “random” team who happens to be on the same time.
Create your programs based on the messages identified below:
Message from client Example Message(s) received from IM Directory Server Register name passwd Register MHumphrey 123go
Already Registered Unknown Error Unregister name passwd Unregister MHumphrey 123go
Not Registered Bad Password Unknown Error List Registered Num (newline, then “Num” newline- separated strings) Unknown Error Login name passwd hostname port
Login MHumphrey 123go barney.cs.virginia.edu 50056
Already LoggedIn Not Registered
some messages that could benefit from more, less, or different responses? ( Keep in mind issues of complexity, interoperability, debuggability, etc.)
Grading Policy for this Programming Assignment
Each program must be properly and reasonably designed, documented, implemented, and tested/evaluated. The grading for this part of the assignment will be:
What to hand in AND email
You must both hand-in a paper copy of your answers to both parts of this assignment AND email an electronic copy (PDF) of both parts of this assignment to [email protected] by 12:30pm on Thursday Feb 15. Each student should submit his/her solutions to Part 1 separately, and each team should submit only one solution to Part 2 (make sure that all submissions to Part 1 and Part 2 clearly contain the names of your team’s members).