Home | Trees | Indices | Help |
|
---|
|
Send and receive shares.
All players are connected by pair-wise connections and this Twisted protocol is one such connection. It is used to send and receive shares from one other player.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from |
|
|||
Inherited from Inherited from Inherited from Inherited from |
|
|||
incoming_data Data expected to be received in the future. |
|||
sent_packets Statistics |
|
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.
|
Called when the connection is shut down. Clear any circular references here, and any external references to this Protocol. The connection has been closed.
|
Called when a share is received. The string received is unpacked into the program counter, and a data part. The data is passed the appropriate Deferred in self.incoming_data.
|
Send data to the peer. The program_counter is a tuple of unsigned integers, the data_type is an unsigned byte and data is a string. The data is encoded as follows: +---------+-----------+-----------+--------+--------------+ | pc_size | data_size | data_type | pc | data | +---------+-----------+-----------+--------+--------------+ 2 bytes 2 bytes 1 byte varies varies The program counter takes up 4 * pc_size bytes, the data takes up data_size bytes. |
Send a share. The program counter and the share are converted to bytes and sent to the peer. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 19 16:43:47 2009 | http://epydoc.sourceforge.net |