|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucr.core.NetConnection
The NetConnection represents a connection to the P2P network. The connection consists of one or more socket connections to servant nodes on the network.
The following is an example initiating a NetConnection.
NetConnection c = new NetConnection("192.168.0.1", 6346); c.start();
Field Summary | |
private static ConnectionData |
connectionData
|
private ConnectionList |
connectionList
|
private static java.lang.String |
greeting
|
private HostCache |
hostCache
|
private static IncomingConnectionManager |
incomingConnectionManager
|
private static OutgoingConnectionManager |
outgoingConnectionManager
|
private Router |
router
|
private static java.lang.String |
SERVER_READY
|
private boolean |
shutdownFlag
|
Constructor Summary | |
NetConnection()
Constructs an empty connection, the application must add a host cache or servant to generate activity |
|
NetConnection(ConnectionData connData)
Construct the connection specifying connection data. |
|
NetConnection(ConnectionData connectionData,
java.lang.String host,
int port)
Construct the connection, providing ConnectionData
to initialize the connection and the address of a host cache servant |
|
NetConnection(java.lang.String host,
int port)
Construct the connection using default connection data and the supplied information regarding the host cache on the network |
Method Summary | |
ServerSession |
createServerSession(MessageReceiver receiver)
Creates a file serving session. |
Session |
createSession(MessageReceiver receiver)
Creates a trace to find out information about the neighborhood |
ConnectionData |
getConnectionData()
Get the ConnectionData settings |
java.util.LinkedList |
getConnectionList()
Gets the current list of connections to GNUTella |
ConnectionList |
getConnections()
Get the connection list |
HostCache |
getHostCache()
Get the current HostCache . |
short[] |
getServantIdentifier()
Get the servant identifier the NetConnection
is using. |
void |
start()
Starts the connection |
void |
stop()
Stop the connection, after execution the NetConnection
is unusable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.lang.String greeting
private static java.lang.String SERVER_READY
private boolean shutdownFlag
private static ConnectionData connectionData
private HostCache hostCache
private ConnectionList connectionList
private Router router
private static IncomingConnectionManager incomingConnectionManager
private static OutgoingConnectionManager outgoingConnectionManager
Constructor Detail |
public NetConnection() throws java.net.UnknownHostException, java.io.IOException
public NetConnection(java.lang.String host, int port) throws java.net.UnknownHostException, java.io.IOException
host
- can be a machine name or IP addressport
- port to usepublic NetConnection(ConnectionData connData) throws java.net.UnknownHostException, java.io.IOException
connData
- connection datapublic NetConnection(ConnectionData connectionData, java.lang.String host, int port) throws java.net.UnknownHostException, java.io.IOException
ConnectionData
to initialize the connection and the address of a host cache servant
connectionData
- configuration data for the connectionhost
- can be a machine name or IP addressport
- to useMethod Detail |
public void start()
public void stop()
NetConnection
is unusable. A new connection must be created if needed. If a
temporary disconnect from NodeConnections is desired, the connection count
requests can be set to 0
public HostCache getHostCache()
HostCache
. Using the HostCache
an application can query the known hosts, and add and remove hosts
public ConnectionData getConnectionData()
ConnectionData
settings
public Session createSession(MessageReceiver receiver)
receiver
- receiver for search responses
public ServerSession createServerSession(MessageReceiver receiver)
FileServerSession
can respond
with a query hit
receiver
- message receiverpublic java.util.LinkedList getConnectionList()
public ConnectionList getConnections()
public short[] getServantIdentifier()
NetConnection
is using. The servant identifier is used in connection with Push
message processing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |