|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Connection
Defines an interface by which two parties can communicate using the Gnutella
protocol over a Socket. Any capabilities or bandwidth statistics
about the connection are retrievable using the
getConnectionCapabilities() or
getConnectionBandwidthStatistics() methods.
Connection exposes no methods for reading or 'starting', as it
is possible for two implementations to use very different methods for
processing incoming connections. For example, a blocking implementation would
allow the caller to process messages on a case-by-case basis, reading one at
a time. An asynchronous implementation (such as implementations of
RoutedConnection) would have a start method that would funnel
received messages to a third party.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.limewire.io.IpPort |
|---|
IpPort.IpComparator, IpPort.IpPortComparator |
| Nested classes/interfaces inherited from interface org.limewire.io.Address |
|---|
Address.EventType |
| Field Summary |
|---|
| Fields inherited from interface org.limewire.io.Connectable |
|---|
COMPARATOR, EMPTY_LIST, EMPTY_SET |
| Fields inherited from interface org.limewire.io.IpPort |
|---|
IP_COMPARATOR |
| Method Summary | |
|---|---|
boolean |
allowNewPings()
Returns whether or not we should allow new pings on this connection. |
boolean |
allowNewPongs()
Returns whether or not we should allow new pongs on this connection. |
void |
close()
Closes the Connection's socket and thus the connection itself. |
String |
getAddress()
Returns the IP address of the remote host as a string. |
ConnectionBandwidthStatistics |
getConnectionBandwidthStatistics()
|
ConnectionCapabilities |
getConnectionCapabilities()
|
long |
getConnectionTime()
Returns the time this connection was established, in milliseconds since January 1, 1970. |
InetAddress |
getInetAddress()
Returns the address of the foreign host this is connected to. |
InetSocketAddress |
getInetSocketAddress()
Returns the InetSocketAddress of the foreign host this is connected to. |
int |
getListeningPort()
Gets the port that this connection is listening on. |
String |
getLocalePref()
access the locale pref. |
int |
getPort()
Accessor for the port number this connection is listening on. |
String |
getPropertyWritten(String name)
Returns the value of the given outgoing (written) connection property, or null if no such property. |
Socket |
getSocket()
Accessor for the Socket for this connection. |
void |
handleSimppVM(SimppVM simppVM)
Sends the SimppVM down the connection |
void |
handleVendorMessage(VendorMessage vm)
Call this method when you want to handle us to handle a VM. |
boolean |
isOpen()
|
boolean |
isOutgoing()
Used to determine whether the connection is incoming or outgoing. |
boolean |
isReadDeflated()
Returns true if the incoming stream is deflated. |
boolean |
isStable()
Checks whether this connection is considered a stable connection, meaning it has been up for enough time to be considered stable. |
boolean |
isStable(long millis)
Checks whether this connection is considered a stable connection, by comparing the time it was established with the millis argument. |
boolean |
isTLSCapable()
Returns true if no capabilites VM is received and the connection is TLS encoded, or if a capabilites VM is received and it advertises support for TLS. |
boolean |
isTLSEncoded()
Returns true if the connection is currently over TLS. |
boolean |
isWriteDeflated()
Returns true if the outgoing stream is deflated. |
void |
send(Message m)
Sends a message. |
void |
sendPostInitializeMessages()
Call this method when the Connection has been initialized and accepted as 'long-lived'. |
void |
sendUpdatedCapabilities()
Call this method if you want to send your neighbours a message with your updated capabilities. |
void |
setListeningPort(int port)
Sets the port where the connected node listens at, not the one got from socket |
| Methods inherited from interface org.limewire.io.Address |
|---|
equals, getAddressDescription, hashCode |
| Method Detail |
|---|
ConnectionCapabilities getConnectionCapabilities()
ConnectionBandwidthStatistics getConnectionBandwidthStatistics()
void handleVendorMessage(VendorMessage vm)
void sendPostInitializeMessages()
void sendUpdatedCapabilities()
void setListeningPort(int port)
long getConnectionTime()
boolean isOutgoing()
void send(Message m)
throws IOException
IOExceptionString getAddress()
getAddress in interface IpPortint getPort()
getPort in interface IpPortint getListeningPort()
InetSocketAddress getInetSocketAddress()
throws IllegalStateException
getInetSocketAddress in interface IpPortIllegalStateException - if this is not initialized
InetAddress getInetAddress()
throws IllegalStateException
getInetAddress in interface IpPortIllegalStateException - this is not initialized
Socket getSocket()
throws IllegalStateException
IllegalStateException - if this connection is not yet initializedboolean isStable()
boolean isStable(long millis)
String getPropertyWritten(String name)
boolean isOpen()
void close()
boolean isWriteDeflated()
boolean isReadDeflated()
boolean isTLSCapable()
isTLSCapable in interface Connectableboolean isTLSEncoded()
boolean allowNewPings()
boolean allowNewPongs()
void handleSimppVM(SimppVM simppVM)
throws IOException
IOExceptionString getLocalePref()
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||