LimeWire Consolidated API

com.limegroup.gnutella
Interface ConnectionServices

All Known Implementing Classes:
ConnectionServicesImpl

public interface ConnectionServices


Method Summary
 void connect()
          Connects to the network.
 void connectToHostAsynchronously(String hostname, int portnum, SocketsManager.ConnectType type)
          Creates a new outgoing messaging connection to the given host and port.
 int countConnectionsWithNMessages(int messageThreshold)
          Count how many connections have already received N messages
 void disconnect()
          Disconnects from the network.
 int getActiveConnectionMessages()
          Count up all the messages on active connections
 int getNumInitializedConnections()
          Returns the number of initialized messaging connections.
 Collection<IpPort> getPreferencedHosts(boolean isUltrapeer, String locale, int num)
          Returns a collection of IpPorts, preferencing hosts with open slots.
 boolean isActiveSuperNode()
          Tells whether the node is currently connected to the network as a supernode or not.
 boolean isConnected()
          Returns whether or not this client currently has any initialized connections.
 boolean isConnectedTo(InetAddress addr)
          Determines if you're connected to the given host.
 boolean isConnecting()
          Returns whether or not this client is attempting to connect.
 boolean isFullyConnected()
          Returns whether or not this client currently has any initialized connections.
 boolean isShieldedLeaf()
          Accessor for whether or not this node is a shielded leaf.
 boolean isSupernode()
          Tells whether the node is a supernode or not.
 void removeConnection(RoutedConnection c)
          Closes and removes the given connection.
 

Method Detail

isShieldedLeaf

boolean isShieldedLeaf()
Accessor for whether or not this node is a shielded leaf.

Returns:
true if this node is a shielded leaf, false otherwise

isActiveSuperNode

boolean isActiveSuperNode()
Tells whether the node is currently connected to the network as a supernode or not.

Returns:
true, if active supernode, false otherwise

isSupernode

boolean isSupernode()
Tells whether the node is a supernode or not. NOTE: This will return true if this node is capable of being a supernode but is not yet connected to the network as one (and is not a shielded leaf either).

Returns:
true, if supernode, false otherwise

isConnecting

boolean isConnecting()
Returns whether or not this client is attempting to connect.


isConnected

boolean isConnected()
Returns whether or not this client currently has any initialized connections.

Returns:
true if the client does have initialized connections, false otherwise

isFullyConnected

boolean isFullyConnected()
Returns whether or not this client currently has any initialized connections.

Returns:
true if the client does have initialized connections, false otherwise

getPreferencedHosts

Collection<IpPort> getPreferencedHosts(boolean isUltrapeer,
                                       String locale,
                                       int num)
Returns a collection of IpPorts, preferencing hosts with open slots. If isUltrapeer is true, this preferences hosts with open ultrapeer slots, otherwise it preferences hosts with open leaf slots. Preferences via locale, also.

Parameters:
num - How many endpoints to try to get

countConnectionsWithNMessages

int countConnectionsWithNMessages(int messageThreshold)
Count how many connections have already received N messages


getActiveConnectionMessages

int getActiveConnectionMessages()
Count up all the messages on active connections


removeConnection

void removeConnection(RoutedConnection c)
Closes and removes the given connection.


disconnect

void disconnect()
Disconnects from the network. Closes all connections and sets the number of connections to zero.


connect

void connect()
Connects to the network. Ensures the number of messaging connections (keep-alive) is non-zero and recontacts the pong server as needed.


isConnectedTo

boolean isConnectedTo(InetAddress addr)
Determines if you're connected to the given host.


connectToHostAsynchronously

void connectToHostAsynchronously(String hostname,
                                 int portnum,
                                 SocketsManager.ConnectType type)
Creates a new outgoing messaging connection to the given host and port. Returns immediately without blocking. If hostname would connect us to ourselves, returns immediately.


getNumInitializedConnections

int getNumInitializedConnections()
Returns the number of initialized messaging connections.


LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.