source: trunk/java-client/org/nzdl/gsdl/ptp/Node.java@ 2120

Last change on this file since 2120 was 2120, checked in by say1, 23 years ago

javadoc fix

  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/*
2 * TODO.java
3 * Copyright (C) 2000 Stuart Yeates
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20// the package we're in
21package org.nzdl.gsdl.ptp;
22
23// java standard library classes used
24import java.io.IOException;
25import java.io.Reader;
26import java.io.InputStreamReader;
27import java.io.Writer;
28import java.io.OutputStreamWriter;
29import java.io.BufferedInputStream;
30import java.io.BufferedOutputStream;
31import java.io.Serializable;
32//import java.io.;
33import java.util.*;
34import java.net.*;
35
36
37/**
38 * Class representing a Node in a Peer-To-Peer (PTP) network.
39 *
40 * Does very little actual work, but maintains a number of important
41 * statics and contains the command-line parsing and initialisation
42 * code (or it will).
43 *
44 * Unlike PTP networks as Napster and Gnutella queries are not
45 * propogated, only knowledge about servers.
46 *
47 * @author stuart yeates ([email protected])
48 * @version $Revision: 2120 $
49 * @see org.nzdl.gsdl.ptp.Poller
50 * @see <a href="http://www.napster.com/">Napster</a>
51 * @see <a href="http://gnutella.wego.com/">Gnutella</a>
52 *
53 */
54
55public class Node {
56
57 /** A list of Locators which we know. */
58 static Properties knownList = new Properties();
59
60 /** Our IOR string*/
61 static String identityIOR = "IOR:123456789012345678901234567890123456789012345678901234567890";
62
63 /** Our HTTP string */
64 static String identityHTTP = "http://www.nzdl.org";
65
66 /** The port we listen on */
67 static int identityPort = 4567;
68 /** Our host name */
69 static String identityHost = null; //= InetAddress.getLocalHost().getHostName();
70 /** Our PTP object ...*/
71 static String identityPTP = identityHost + ":" + identityPort;
72
73 /** Initialise the static variables */
74 void init(){
75 if (identityHost == null) {
76 try {
77 identityHost = InetAddress.getLocalHost().getHostName();
78 identityPTP = identityHost + ":" + identityPort;
79 } catch (Exception exception) {
80 System.err.println("caught exception: "+exception);
81 }
82 }
83
84 }
85
86 /**
87 * Construct and rung a Node ...
88 */
89 public Node() {
90
91 init();
92
93 // start the server ...
94 Listener listener = new Listener();
95 listener.run();
96
97 // start the poller ...
98 Poller poller = new Poller();
99 poller.run();
100
101 }
102
103
104 /**
105 * Tests...
106 *
107 *
108 * @exception java.io.IOException when ...
109 * @param args the arguments ...
110 */
111
112 public static void main(String args[]) throws IOException
113 {
114 Node node = new Node();
115 }
116}
117
118
Note: See TracBrowser for help on using the repository browser.