|

ICT Home
DC Home
Notice Board
Resources
Modules
Virgil Main
Virgil Forum
|
Assignment 1 for Semester 2, 2006 (Draft)
The aim of this assignment is to gain some experience in
designing and implementing distributed computing applications on
the Internet using the peer-to-peer computing and communication
model and protocols. The programming language will be Java.
Communication protocols in the distributed application will be
based on sockets.
Implementation of the protocol in a different programming
language may be possible. If you prefer using a different language,
please contact the course convenor first!
Virtual Photo Album
Your task in this assignment is to design, implement, test, and
discuss a peer-to-peer distributed photo album.
The system uses a protocol for distributed membership on the Internet.
Although the actual downloading and viewing of a photo follows a
client/server paradigm,
the distinction of the system is its peer-to-peer decentralised
computing and communication model. In this model, every client is
a server, and vice versa. These so-called servents perform
tasks normally associated with both clients and servers. They
provide client-side interfaces through which users can issue
queries and view search results, while at the same time they also
accept queries from other servents, check for matches against their
local data set, and respond with applicable results.
Due to its special communication protocol, a network of servents
is highly fault-tolerant, as operation of the network will not be
interrupted if a subset of servents goes offline.
Your program should implement the the two parts that make up the
system, the membership service and the photo viewing
system. In total, the following basic functionality
should be implemented in each servent:
- A GUI user interface to accept input and display results.
In particular, a user should be able to search for, add, delete,
and view photos, as well as mangage network connectivity.
- The protocol to connect a servent to the
network. See the protocol specification below for
details.
- Four protocol messages Ping, Pong,
Query and QueryHit and their routing rules (see
the protocol specification for details).
- A simple download protocol to send a photo from one node to another one,
where the photo gets displayed.
Your program (a network of at least 4 servents) must be
tested on both single and multiple machines. This means that either
just one or multiple servents need to run on each machine (think
multiple users on a single machine). To allow multiple
servents on one machine, you need to be able to specify a local port
number to use when the servent starts (either as a command line parameter
or through the GUI).
To enable a servent to know
which hosts are active, you may supply each servent with an initial
list of potential hosts (IP addresses and port numbers)
to which it
attempts to communicate. This list should be configurable at run
time (e.g., through the command line or the GUI).
The Membership Service
The membership service is the primary way in which servents communicate
over the network.
It consists of a set of messages used for communication
between servents and a set of rules governing the inter-servent
exchange of messages.
Messages
The messages are defined as follows:
Message Header
Every message is prepended by a header, containing common information
for all messages. This message header contains at least the
following information:
- Descriptor ID
- A value or string that uniquely identifies a message. No
two messages sent may ever have the same descriptor ID!
- TTL
- Time To Live.
The number of times the descriptor will be forwarded by
servents before it is removed from the network.
Each servent will decrement the TTL before passing it on
to another servent.
When the TTL reaches 0, the descriptor will no longer be
forwarded.
- Hops
- The number of times the descriptor has been forwarded.
As a descriptor is passed from servent to servent,
the TTL and Hops fields of the header must satisfy the
following condition:
TTL(0) = TTL(i) + Hops(i)
Where TTL(i) and Hops(i) are the value of the TTL and Hops
fields of the header at the descriptor's i-th hop, for i >= 0.
- Payload Descriptor
- The message type. This identifies payload data for one of
the following four message types.
Immediately after the header, a message is followed by one of the
following four types of payload data.
Ping
This message is used to actively discover servents and users on
the network.
A servent receiving a Ping is expected to respond with one or
more Pong descriptors.
The Ping message does not contain any payload data.
Pong
The response to a Ping. Includes the IP address and port number
of a connected servent and information regarding the number of
users it is making available to the network. Individual assignments
only need to be able to handle one user per servent (but multiple
servents, and thus, multiple users per computer). If you are working
on your assignment in a pair with another student, each servent needs
to support multiple users at the same time (in addition to allowing
muliple servents per computer).
A Pong message contains at least the following data:
- IP Address
- The IP Address of a servent within the network
- Port
- The port number on which that servent can be reached
- Number of Users
- The number of users on that host (optional for individual assignments)
Query
The Query message is the primary mechanism for searching the
distributed network for photos. A servent receiving a Query descriptor
will respond with a QueryHit if a match is found against its
local data set. The Query message only contains one element,
a photo name search string. An empty string denotes that
all users should be reported, otherwise all users whose name
starts with the search string should be returned.
QueryHit
The response to a Query. This descriptor provides the recipient
with enough information to download a photo matching the
corresponding Query.
Zero or more QueryHit messages will be sent in response to every
Query.
A QueryHit message contains the following data:
- Photo Name
- The name of a photo logged stored on a servent
- IP Address
- The IP Address of a that servent
- Port
- The port on which the photo can be downloaded from the servent
Routing
The peer-to-peer nature of the network requires servents to route network
traffic (queries, query replies, etc.) appropriately.
A well-behaved servent will route protocol descriptors according to the
following rules:
- Pong descriptors may only be sent along the same path that
carried the incoming Ping descriptor. This ensures that only
those servents that routed the Ping descriptor will see the Pong
descriptor in response. A servent that receives a Pong descriptor
with Descriptor ID = n, but has not seen a Ping descriptor with
Descriptor ID = n should remove the Pong descriptor from the network.
- QueryHit descriptors may only be sent along the same path that carried
the incoming Query descriptor. This ensures that only those servents
that routed the Query descriptor will see the QueryHit descriptor in
response. A servent that receives a QueryHit descriptor with
Descriptor ID = n, but has not seen a Query descriptor with
Descriptor ID = n should remove the QueryHit descriptor from the network.
- A servent will forward incoming Ping and Query descriptors to all of
its directly connected servents, except the one that delivered the
incoming Ping or Query.
- A servent will decrement a descriptor header's TTL field, and increment
its Hops field, before it forwards the descriptor to any directly
connected servent. If, after decrementing the header's TTL field,
the TTL field is found to be zero, the descriptor is not forwarded
along any connection.
- A servent receiving a descriptor with the same Payload Descriptor
and Descriptor ID as one it has received before, should discard
the message (and not forward it on).
The Photo Viewing System
Add a simple mechanism of downloading photos from a remote servent.
A viewer window should then display the first photo. The viewer
window should have two buttons, one to display the next photo in
sequence and one button to display the previous photo. Through these
buttons, the user should be able to cycle through all the photos
matched by a query (i.e. the list of all QueryHit responses to a
Query message).
A servent only needs to be able to have one
photo viewing window open at a time.
Viewing Photos
The procedure, from the user's perspective, for
viewing photos is as follows:
- A user sends an empty query string to find all the available
photos, or searches for a particular (set of) photo(s) by
specifying a non-empty query string.
- In response, the user will get a list of (zero or more)
name/servent combinations that match that query. If the
query string was empty, all the names and servents of all
photos that are currently available online should be returned.
- When selecting a photo or a set of photos, these should
be displayed in the viewer window.
General Suggestions
- Read this document carefully.
- Attend all tutes and lab sessions
for discussing the techniques related to this
assignment.
- Read through the
Java Image-I/O API Guide
for an introduction on how to load and display photos (images).
- It's not hard to find existing Java implementations of
peer to peer programs, and you are welcome to inspect these as a source of
ideas. But you can hardly submit one as your solution for a
variety of obvious reasons. Remember, plagiarism is serious academic
misconduct and will be penalised.
Assessment
This assignment is worth 30 marks (30% of the total maximum
marks for the course).
This is an individual assignment, group work is not permitted.
Your project will be judged on its correctness, functionality,
documentation, and general quality. 80% of the total marks
will be allocated for the correctness, functionality, and quality
of the implemented program, and 20% of the total marks for
the quality of the accompanying documentation and demonstration.
Submission Procedure
You must submit your work (including your program and
and documentation) electronically using
this web page.
You should submit your work in time. Penalties for late
submissions are 10% per day late!
Due Date
This assignment is due on Friday, 8 September 2006
(End of week 7).
Electronic submission
Your electronic submission should consist of a
ZIP
file, including a .jar file capable of being executed, a
well-presented, compilable listing of your source, and documentation
(see below). You need to demonstrate your running program.
in the week after the assignment is due (or the week thereafter,
if you are submitting late).
Use Virgil to
electronically submit your assignment
by
following this link.
Documentation Submission
Your documentation should be in electronic form. It should be included
in the above ZIP file and comprise the following:
- A cover page, clearly showing the code and name of the
course (3510CIT Distributed Computing), your name and student
number.
- A report containing a brief description of your design, the
reasons for your main design decisions, a summary of the
program's functionality and limitations, a reflective analysis
of your approach and achievements, a description of the testing
performed, a discussion of how you could extend the program,
and instructions for running the program.
- A listing of Java source files (with sensible comments)
which implement the program.
Last Changed: $Date: 2006/08/30 22:26:09 $
|