Package twisted :: Package protocols :: Module gnutella :: Class GnutellaPinger

[show private | hide private]
[frames | no frames]

## Class GnutellaPinger

    BaseProtocol --+
                   |
            Protocol --+
                       |
            LineReceiver --+
                           |
              GnutellaTalker --+
                               |
                              GnutellaPinger

Just for testing. It does nothing but send PINGs.

Method Summary
| `__init__(self)`
| ``connectionFailed`(self)` (Deprecated) (inherited from `Protocol`)
| ``connectionLost`(self, reason)` Called when the connection is shut down. (inherited from `Protocol`)
| ``connectionMade`(self)` Called when a connection is made.
| ``dataReceived`(self, data)` Protocol.dataReceived. (inherited from `LineReceiver`)
| ``descriptorReceived`(self, descriptor)` A Gnutella descriptor has arrived. (inherited from `GnutellaTalker`)
| ``handlePing`(self, descriptorId, ttl, hops, payload)` A ping message has arrived. (inherited from `GnutellaTalker`)
| `handlePong(self, descriptorId, ttl, hops, payload)` (inherited from `GnutellaTalker`)
| `handlePush(self, descriptorId, ttl, hops, payload)` (inherited from `GnutellaTalker`)
| `handleQuery(self, descriptorId, ttl, hops, payload)` (inherited from `GnutellaTalker`)
| `handleQueryHit(self, descriptorId, ttl, hops, payload)` (inherited from `GnutellaTalker`)
| ``lineLengthExceeded`(self, line)` Called when the maximum line length has been reached. (inherited from `LineReceiver`)
| ``lineReceived`(self, line)` Precondition: We must be expecting a GNUTELLA CONNECT handshake move.: (self.initiator and (self.handshake == "initiatorsaidhello")) or ((not self.initiator) and (self.handshake == "start")): "self.initiator: %s, self.handshake: %s, line: %s" % (str(self.initiator), str(self.handshake), str(line),) (inherited from `GnutellaTalker`)
| `loopAndSendPing(self)`
| ``pingReceived`(self, descriptorId, ttl, hops)` Override this to handle ping messages. (inherited from `GnutellaTalker`)
| ``pongReceived`(self, descriptorId, ttl, hops, ipAddress, port, numberOfFilesShared, kbShared)` Override this to handle pong messages. (inherited from `GnutellaTalker`)
| ``pushReceived`(descriptorId, ttl, hops, ipAddress, port, serventIdentifier, fileIndex)` Override this to handle push messages. (inherited from `GnutellaTalker`)
| ``queryHitReceived`(self, descriptorId, ttl, hops, ipAddress, port, resultSet, serventIdentifier, speed)` Override this to handle query hit messages. (inherited from `GnutellaTalker`)
| ``queryReceived`(self, descriptorId, ttl, hops, searchCriteria, minimumSpeed)` Override this to handle query messages. (inherited from `GnutellaTalker`)
| ``rawDataReceived`(self, data)` Override this for when raw data is received. (inherited from `GnutellaTalker`)

``sendDescriptor`(self, descriptorId, payloadDescriptor, ttl, payload)`
Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) Precondition: payload must not be larger than MAXUINT32 bytes.: len(payload) <= MAXUINT32: "len(payload): %s" (inherited from `GnutellaTalker`)

| ``sendLine`(self, line)` Sends a line to the other end of the connection. (inherited from `LineReceiver`)
| ``sendPing`(self, ttl)` Precondition: ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl) (inherited from `GnutellaTalker`)

``sendPong`(self, ttl, descriptorId, host, port, numberOfFilesShared, kbShared)`
Precondition: ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl) Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) Precondition: host must be a well-formed IPv4 address.: is_ipv4(host): "host: %s" % str(host) Precondition: port must be > 0 and <= MAXUINT16.: (port > 0) and (port <= MAXUINT16): "port: %s" % str(port) Precondition: numberOfFilesShared must be >= 0 and <= MAXUINT32.: (numberOfFilesShared >= 0) and (numberOfFilesShared <= MAXUINT32): "numberOfFilesShared: %s" % str(numberOfFilesShared) Precondition: kbShared must be >- 0 and <= MAXUINT32: (kbShared >= 0) and (kbShared <= MAXUINT32): "kbShared: %s" % str(kbShared) (inherited from `GnutellaTalker`)

| `setInitiator(self)` (inherited from `GnutellaTalker`)
| ``setLineMode`(self, extra)` Sets the line-mode of this receiver. (inherited from `LineReceiver`)
| ``setRawMode`(self)` Sets the raw mode of this receiver. (inherited from `LineReceiver`)

Method Details

### connectionMade(self)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

  Overrides:
    `twisted.protocols.gnutella.GnutellaTalker.connectionMade` (inherited documentation)

Generated by Epydoc 1.1 on Sat Feb 15 21:17:58 2003 | http://epydoc.sf.net