I shall create a new question for you to post up your


  • o If you want to do this but do not have enough time, please post a comment telling me of your intention to answer.
  • o Make a bookmark.
  • o Come back to this question and comment below when you finish.
  • o I shall create a new question for you to post up your answer so you can earn the points you deserve for helping me out! :D

o Project is due in 10 days. Earlier the better. =)
Checks:

  • x Please comment your code so I can read it well.
  • x Please also include link for me to download your .java files (Multiple .java files are okay).
  • x Rating 3* for willingness, 4* for working code, 5* for working code with good comments. Thanks :)
  • x Put any Questions in comments.

 

Steps involved:

  1. 1. Initialization
  2. 2.   Ping Mechanism
  3. 3.   File Request
  4. 4.   Peer Churn.

 

(Example shown in brackets).

 

Input and Initialization Specifications:

  • Takes in 3 integer arguments. (e.g. java cdht 1 42 58)
  • First argument ("1") is the identity of the peer to be initialized
  • Second argument is successor1,
  • Third argument is sucessor2 ("42" and "58") are the two successive peers.

Notes:

  • Max 10 peers.
  • Identities of peers in the range of [0, 255].
  • Use local host as IP Adress ("127.0.0.1")
  • Use UDP protocol at port 50,000 + x for x = peer number (First argument)



Ping Mechanism

  • My understanding is that a peer regularly pings its successive peers (42 and 58) via their port numbers (50,042 and 50,058) and receives back a response.
  • When receiving either a request or response please output a string:
    "A ping response/request was received from peer X" where X is the peer's identity (1, 42, 58)



File Request

  • Assume peer 1 is looking for a file 59, he types the string: request 59.
  • This forwards on to its successor1 (peer 42).
  • Peer 42 checks if 59 < it's successor1 identity (58) --> No.
  • Peer 42 then passes the request to Peer 58.
  • Peer 58 checks 59 against it's successor1 identity (e.g. 63) --> Yes
  • Peer 58 sends a response through its predecessors back to peer 1 saying he has the file.



Peer Churn
Ungraceful Exit

  • o Timeout function required so that if no response is received after 1 second of ping, the program seeks the alive successor's immediate successor. (peer 42 is dead, peer 1 requests peer 58 for its next successor)
  • o   Peer closes connection to dead peer then connects to this new successor and keeps pinging it.
    (I imagine it will have to reshuffle so that peer 58 = successor1 and the new peer = successor2)


Graceful Exit

  • o   Peer types in: quit
  • o   This sends a message to its peers with its successors so they can change accordingly

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: I shall create a new question for you to post up your
Reference No:- TGS0645843

Expected delivery within 24 Hours