|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.kenmccrary.jtella.GNUTellaConnection
The GNUTellaConnection represents a connection to the GNUTella network. The connection consists of one or more socket connections to servant nodes on the network.
The following is an example initiating a GNUTellaConnection.
GNUTellaConnection c = new GNUTellaConnection("gnutellahosts.com", 6346); c.start();
Constructor Summary | |
GNUTellaConnection()
Constructs an empty connection, the application must add a host cache or servant to generate activity |
|
GNUTellaConnection(ConnectionData connData)
Construct the connection specifying connection data. |
|
GNUTellaConnection(ConnectionData connData,
java.lang.String host,
int port)
Construct the connection, providing ConnectionData
to initialize the connection and the address of a host cache servant |
|
GNUTellaConnection(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 | |
void |
addConnection(java.lang.String ipAddress,
int port)
Attempts an outgoing connection on the specified host |
void |
addHostCacheServant(java.lang.String ipAddress,
int port)
Informs the system of a host cache servant on the network |
FileServerSession |
createFileServerSession(MessageReceiver receiver)
Creates a file serving session. |
SearchSession |
createSearchSession(java.lang.String query,
int maxResults,
int minSpeed,
MessageReceiver receiver)
Creates a session to conduct network searches |
ConnectionData |
getConnectionData()
Get the ConnectionData settings |
java.util.LinkedList |
getConnectionList()
Gets the current list of connections to GNUTella |
HostCache |
getHostCache()
Get the current HostCache . |
SearchMonitorSession |
getSearchMonitorSession(MessageReceiver searchReceiver)
Get a search monitor session to monitor query requests flowing through this network connection. |
short[] |
getServantIdentifier()
Get the servant identifier the GnutellaConnection
is using. |
boolean |
isOnline()
Query if we are online with the network, with at least one active node connection |
void |
removeHostCacheServant(java.lang.String ipAddress,
int port)
Removes host cache servant information |
void |
start()
Starts the connection |
void |
stop()
Stop the connection, after execution the GNUTellaConnection
is unusable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GNUTellaConnection() throws java.net.UnknownHostException, java.io.IOException
public GNUTellaConnection(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 GNUTellaConnection(ConnectionData connData) throws java.net.UnknownHostException, java.io.IOException
connData
- connection datapublic GNUTellaConnection(ConnectionData connData, 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 servanthost
- can be a machine name or IP addressport
- port to useMethod Detail |
public void start()
public void stop()
GNUTellaConnection
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 0public HostCache getHostCache()
HostCache
. Using the HostCache
an application can query the known hosts, and add and remove hostspublic boolean isOnline()
public ConnectionData getConnectionData()
ConnectionData
settingspublic SearchSession createSearchSession(java.lang.String query, int maxResults, int minSpeed, MessageReceiver receiver)
query
- search querymaxResults
- maximum result set sizeminSpeed
- minimum speed for responding servantsreceiver
- receiver for search responsespublic SearchMonitorSession getSearchMonitorSession(MessageReceiver searchReceiver)
searchReceiver
- message receiverpublic FileServerSession createFileServerSession(MessageReceiver receiver)
FileServerSession
can respond
with a query hitreceiver
- message receiverpublic java.util.LinkedList getConnectionList()
public void addConnection(java.lang.String ipAddress, int port)
ipAddress
- host IPport
- port numberpublic void addHostCacheServant(java.lang.String ipAddress, int port)
ipAddress
- host IPport
- port numberpublic void removeHostCacheServant(java.lang.String ipAddress, int port)
ipAddress
- host IPport
- port numberpublic short[] getServantIdentifier()
GnutellaConnection
is using. The servant identifier is used in connection with Push
message processing
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |