Uploaded by game03832015

Assignment 2 - network programming (1)

advertisement
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
EECE 350 – Computer Networks
Network Programming
Problem I: Simple Web Browser
You are asked to write a simple web browser to connect to a webserver and retrieve a given
webpage. You felt overwhelmed and did not know how to get started. After attending EECE
350 classes and tutorials, you found out it is a very easy task to do. In this problem, you need
to provide us with your first attempt to develop a running browser. To do so, you need to
write a program that prompts the user to enter the domain name of the website to be visited.
Your program then constructs a properly formatted GET message and sends it to the
respective webserver to retrieve its base html file. The program starts reading the data
delivered from the webserver and displays it on the screen. Note that HTTP uses TCP as the
underlying transport layer protocol. Hint: use the right network command to get the IP
address of the selected webserver.
Problem 2: Simple Chatting Application
In this problem, you need to demonstrate that you understood the concept of the peer-topeer paradigm. As you may know, there is no dedicated server in a peer-to-peer application.
Any user (peer) can act as both a client and a server. In other words, the program should run
with two threads and uses two sockets. In this problem, you need to implement a very basic
and even “unreliable” chatting application that works in a peer-to-peer mode. This network
application allows two users to chat with each other and exchange text messages. For a user
to contact another user, it needs to know the IP address and the port number. Hint: use the
right network command to get the IP address of a machine.
Problem 3: Rock Paper Scissors – Continued
Now it is time for some fun. Let us extend the Rock Paper Scissors game we started during the
tutorial session to support a hybrid client-server/peer-to-peer architecture. To do so, you
need to develop a dedicated server, which role is to store the IP address and port number of
all online users. A player who wishes to play contacts the server to provide their IP address
and port number and fetch the IP address and port number of the other player they want to
play with. You need to demonstrate that the game runs properly for two players, but you can
certainly extend the game to allow for a larger group of players for extra credit. A player, say
player X, starts first by contacting the server to provide its IP address and port number. If
player X is the first player to join, the server sends a message saying “You are the only online
player!” If another player already joined, the server delivers to Player X the IP address and
port number of the other player, say Player Y. Once player X gets the address of player Y, it
can contact it directly to play the game in a peer-to-peer manner. For all this communication
to take place, you need first to design an application layer protocol that defines the
communication among the different components of the application.
Deliverable
-
-
Source code of well documented programs for each problem
Short report to present the following:
o Problem 1: your choice of the network command and screenshot of the
respective output
o Problem 2: your choice of the underlying transport layer protocol with
justification together with the used network command and a screenshot of its
output
o Problem 3:
 the hybrid client server peer-to-peer architecture of the game
 the application layer protocol that you designed between the client and
the server and between the different peers
 discussion of your choice in regards to the underlying transport layer
protocol
 discussion of the bonus part of how you extended the game to support
more than two players (optional)
Submit all the above to Moodle in a zipped folder
You need to be ready to present a demo of your solution to all problems in case you
are requested to do so
Download