Learning Network Programming with Java by Richard Reese

Learning Network Programming with Java by Richard Reese

Author:Richard Reese [Reese, Richard]
Language: eng
Format: azw3, epub, pdf
Publisher: Packt Publishing
Published: 2015-12-21T16:00:00+00:00


The following code will keep the program running until the user terminates it. The close method is then used to close the table:

Scanner scanner = new Scanner(System.in); System.out.println("Press Enter to terminate application: "); scanner.next(); DHTExample.close();

When the program is executed, you will get an output similar to the following:

dksref://192.168.1.9:4440/0/2179157225/0/1952355557247862269

Press Enter to terminate application:

The client application is described as follows. A new JDHT instance is created using a different port. The second argument is the reference to the first application. You will need to copy the reference and paste it into the client. A different reference will be generated each time the first application is executed:

try { JDHT myDHT = new JDHT(5550, "dksref://192.168.1.9:4440" + "/0/2179157225/0/1952355557247862269"); ... } catch (IOException | DKSTooManyRestartJoins | DKSIdentifierAlreadyTaken | DKSRefNoResponse ex) { // Handle exceptions }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.