Fish for ducks v1.0
(multicast version)
This is the result of the third part of my assignment in the course 2G1118 Network Programming in Java at KTH.
The task was to develop a multicast File Sharing program (FiSh) to be run over internet and
by using Sun Java platform for coding. There may be restrictions on multicast traffic in routers, and therfor
the program may only work on LAN under some circumstances.
The server has been removed and all clients holds it owns list of files they want share. To send search
request, the clients connects to the same multicast group and use UDP to send the messages. The users can use multiple keywords
to search for files. On matches, the results are returned in UDP packets directly to the requester from the other clients after
a random delay to not flood the network so packets with results get lost. The results is then presented to the user who then can
choose which files he/she wants to download. The download is then established directly with the users client holding the desired
file. On disconnection the client sends a leave message to the multicast group and stops listening for requests.
Hardware Information
The client has been developed and tested on Intel-platforms under Windows XP and Red Hat Linux 7.2 (kernel 2.4.9-31).
Java's platform independence should make the program run on many many more platforms that hasn't been tested yet.
Java Software Information
The whole program has been developed by using the editor GNU Emacs 21.1.1 with extended java support by JDEE.
The official release of Java 2 platform, Standard Edition v1.4.0 with its tools has been used for development. But the programs are tested and proven
compatible with v1.3.1.
Implementation
The client
There aren't many changes in the GUI of the client compared to the centralized server version,
and the functionality is also very similar. In this version the centralized server has been
removed and a multicast group is used for sending searchrequests with the UDP protocol.
A separate thread has been added to listen for requests on the specified group, and perform
the search of the locally shared files. The results, if any, are then sent back to the client
asking using connectionless communication with the UDP protocol. To not flood the network with
results on requests, there is a random delay between 0 and 8 seconds before transmission of
results begin. The client will stop reciveiving results when it got 100 results or 10 seconds
has passed. During the search no other search is allowed to be issued by the client.
The threads handling downloads, and uploads had not been modified from the centralized server
version.
Security
When sharing subdirectories there must be a way to tell exactly which file the user want to
download, especially if there is several files with the same name. Any absolute or relative
way to address the file could be a risc if there are bugs in the code or JVM. To avoid that I
have choosen to implement a local vector at the client holding information of all shared files.
When sending the list of shared files to the server, only the filename (no path included), the
filesize and the index in the vector are sent to the server. Index and filename are then used when
another client wants to download a file. The index is used to pick out a record from the local
vector, and the filenames are compared. If there is a match, information from the local vector
is used to choose file and start the download to the requesting client. Therefor only files in
the vector can be downloaded, and the local client is the only one that can access the vector.
Download
Compiled: FishClient
Source code: zip
Getting started
To start the precompiled version of the Client use:
java -jar FishClient.jar
Another way to start the client is to double-click on FishClient.jar
To compile the source code use the included make.bat -file on the Windows-plotforms,
else use these commands:
javac *.java
jar cmf FishClientManifest.mf FishClient.jar FishClient*.class anka.*
javadoc -d api -version -author *.java
Source Code
Client:
FishClient.java
FishClientAboutBox.java
FishClientDownload.java
FishClientDownloadThread.java
FishClientGUI.java
FishClientQueryHandler.java
FishClientQueryThread.java
FishClientServerHandler.java
FishClientServerThread.java
Documentation
API generated by javadoc -tool.
Contact information
Any comments, suggestions and repports of bugs are welcome.
Send a mail to me at: e98_bbe@e.kth.se
(c) 2002 Björn Bertilsson e98_bbe@e.kth.se
|