Archive

Posts Tagged ‘servant’

Simple Java Assignment

November 15th, 2009 Comments off

Purpose:
The purpose of this project is to familiarize the student with the some of the concepts of peer-to-peer computing.
Description:
To do this we will create a servant program similar in function to (but simpler than) Gnutella. The program will consist of two main functions: an HTTP based client similar to a web browser but much simpler and a simple HTTP server. The server used for the HTTP homework assignment can be used and modified for the server portion of the servant. The client and server portions of the servant should run independently of one another (on seperate threads) and the server itself should be threaded so that it can serve multiple clients simultaneously. Inter-servant communications should be limited to standard GET and POST HTTP transactions. Intra-servant communications (between the client and server of the same servant) should be limited to only the minimum required for passing queries on to other servants.
For additional information refer to the class notes and the Gnutella web site.

Specifications:
Server Connection Port: 4911
Protocol: HTTP 1.0
Max Time to live: 3
Local Database: each servant needs to keep a local database that will keep track
of the following: IP address or host name of other on-line servants
Time to live for each connected servant
Files available from each on-line servant
Queries: each client should allow the user to request either a complete directory
list of its file store or a directory list for a specific file type (ex .doc, .jpg).
Queries should be automatically propigated to each community member (until the time to
live has expired; time to live is decremented by one as a query is propigated
to additional servants, when it reaches zero it isn’t propigated any farther).
To pass the TTL and the query from one servant to the next embed the TTL and
Query in the HTTP header as name/vale pairs as if they had been POSTed from
an HTML form.

File Formats:
Directory List File:
line 1 – IP Addr of original requestor n
line 2 – Original Query n
line 3 – filename.filetype n
.
.
.
line n – filename.filetype n

Request and Response Headers:
Request Header:

line 1 – POST / HTTP/1.0
line 2 – Connection: Keep-Alive
line 3 – User-Agent: CS328-Servant
line 4 – Accept-Language: en
line 5 – Content-type: application/x-www-form-urlencoded
line 6 – Content-length:
line 7 –
line 8 – QUERY=JPEG&TTL=3&ORIGIP=128.226.121.nnnn&SUBMIT=Submit

Response Header:
line 1 – “HTTP/1.0 200 OKn”
line 2 – “Allow: GETn”
line 3 – “MIME-Version: 1.0n”
line 4 – “Server: CS328 Basic HTTP Servern”
line 5 – “Content-Type: ” + contentType + “n”
line 6 – “Content-Length: ” + fileLength + “nn”;
Hints:
To make testing easier start out by writing your servant as two seperate programs, first using a regular web browser (Firefox or IE) make sure that your server will serve a directory list of its document store; next make sure that your client can connect to the server and that it can request and display the directory list from your server. Now put the client and server together into a single program and retest everything again.
To retrieve a file from one of the other servants you may either issue an HTTP Get for the specific file directly from the owning servant or retrieve it directly from the owning servant using the URL class in the java.net.* library.

Categories: Java Tags: , , , , , ,

Link Exchange System

April 16th, 2009 Comments off

Central Link exchange database system

There are some client sites that we are only able to add links manually to, but we need to be able to automatically send out requests, and have the html automatically created of the links to be placed on clients pages.

There are other of our websites that have a database links directory that we want to push links requests to (servant sites)

There will be ongoing development/support needed for the system.

The following are the ideas for the system, but first needs your input as to further ideas, a database schema drawn up, then divided into stages to make it easier to program and check off, then programmed.

- data entry screen, and a database of all links partners – email address, main recip link page, firstname/lastname, categories, pr, country, manual or form, with the form link so can easily click through to add the link on their website, 5 variations of their link text, 5 variations of their description, their url.
- data entry screen and a database of our websites – url, 5 search phrases, 5 descriptions (can be one field for search phrases another for descriptions that is separated by “|” and split to an array when used). Able to check box on the search phrases/descriptions that we want used, contact person for that site, email address, number of links required, date initially added, notes field
- servant script on our servant websites that accesses that sites database, and adds the links to that site. The master script sends the partner details of the links to be added.

- ability to select the sites that we want to send link requests to, check box that you can javascript select all/deselect all. Dropdown select based on category/all categories/select one or more categories
- ability to send email requests to all those websites by clicking a button, and the link requests are a random of one of our clients search phrases, and one of the descriptions. Sending details of the page that we are adding their link to and the link text/description of it.
- creation of html for the links to the links partners – so can manually add the links to certain pages (if the site is not a servant site). Links are random title/description, and random placement on the list
- list of all the dated links requests sent per client website, and data entry for each so can update with the recip link, and date that recip link existed. PR per links page, and number of do followed (ie excluding no followed) links on that page. Clickable links on that list so can manually check
- tabulated summary of number of all reciprocated links made per month per client
- a routine that goes through all unique links, and gets the pr of all the pages/number of links on the pages, checks for recip links for each, noting those links that are not reciprocated so they can be manually deleted.
- able to select what template of email text to be sent, and what signature and name/from its being sent from.

Bear