|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectseda.sandStorm.lib.Gnutella.GnutellaServer
public class GnutellaServer
A GnutellaServer is a SandStorm stage which allows outgoing connections to be established to the Gnutella network, and accepts incoming connections. The server has a client sink associated with it, onto which GnutellaConnection and GnutellaPacket events are pushed. When a connection is closed, a SinkClosedEvent is pushed, with the sink pointer set to the GnutellaConnection that closed. If a an outgoing connection fails, a GnutellaConnectFailedevent is pushed.
GnutellaConnection, GnutellaPacket
Nested Class Summary | |
---|---|
(package private) class |
GnutellaServer.connectionState
Internal class used to monitor state of connections during handshake phase |
Field Summary |
---|
Fields inherited from interface seda.sandStorm.lib.Gnutella.GnutellaConst |
---|
DEFAULT_DOWNLOAD_PORT, DEFAULT_GNUTELLA_PORT, DEFAULT_HOPS, DEFAULT_PING_INTERVAL, DEFAULT_SPEED, DEFAULT_TTL, GNUTELLA_CONNECT, GNUTELLA_FN_PING, GNUTELLA_FN_PONG, GNUTELLA_FN_PUSH, GNUTELLA_FN_QUERY, GNUTELLA_FN_QUERYHITS, GNUTELLA_OK, MAX_PAYLOAD_SIZE, PACKET_HEADER_SIZE, WRITE_CLOG_THRESHOLD |
Constructor Summary | |
---|---|
GnutellaServer(ManagerIF mgr,
SinkIF clientSink)
Create a Gnutella server listening for incoming connections on the default port of 6346. |
|
GnutellaServer(ManagerIF mgr,
SinkIF clientSink,
int listenPort)
Create a Gnutella server listening for incoming connections on the given listenPort. |
Method Summary | |
---|---|
(package private) void |
cleanupConnection(ATcpConnection tcpconn,
GnutellaConnection gc)
|
(package private) void |
closeConnection(ATcpConnection tcpconn,
SinkIF compQ)
|
void |
destroy()
Called when an event handler is destroyed. |
(package private) SinkIF |
getSink()
|
void |
handleEvent(QueueElementIF qel)
Handle the event corresponding to the given QueueElementIF. |
void |
handleEvents(QueueElementIF[] qelarr)
Handle the events corresponding to the given QueueElementIF array. |
void |
init(ConfigDataIF config)
Called when an event handler is initialized. |
void |
openConnection(java.net.InetAddress address,
int port)
Open a connection to the given address and port. |
void |
openConnection(java.lang.String hostname,
int port)
Open a connection to the given hostname and port. |
void |
registerSink(SinkIF sink)
Register a sink to receive incoming packets on this connection. |
void |
sendToAllButOne(GnutellaPacket pkt,
GnutellaConnection exclude)
Send a packet to all nodes but the given node. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GnutellaServer(ManagerIF mgr, SinkIF clientSink) throws java.lang.Exception
java.lang.Exception
public GnutellaServer(ManagerIF mgr, SinkIF clientSink, int listenPort) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public void init(ConfigDataIF config) throws java.io.IOException
EventHandlerIF
init
in interface EventHandlerIF
config
- The set of configuration parameters for the stage.
java.io.IOException
public void destroy()
EventHandlerIF
destroy
in interface EventHandlerIF
public void openConnection(java.lang.String hostname, int port) throws java.net.UnknownHostException
java.net.UnknownHostException
public void openConnection(java.net.InetAddress address, int port)
public void handleEvent(QueueElementIF qel)
EventHandlerIF
handleEvent
in interface EventHandlerIF
public void handleEvents(QueueElementIF[] qelarr)
EventHandlerIF
handleEvents
in interface EventHandlerIF
void closeConnection(ATcpConnection tcpconn, SinkIF compQ)
void cleanupConnection(ATcpConnection tcpconn, GnutellaConnection gc)
public java.lang.String toString()
toString
in class java.lang.Object
public void registerSink(SinkIF sink)
SinkIF getSink()
public void sendToAllButOne(GnutellaPacket pkt, GnutellaConnection exclude)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |