Package legume :: Package udp :: Module buffer :: Class EndpointBuffer
[frames] | no frames]

type EndpointBuffer

object --+
         |
        EndpointBuffer

A two-way buffer.

An MTU of 1400 bytes is set for the maximum payload of a UDP packet that can be sent by the buffer. Currently a message cannot span over multiple UDP packets and a MessageError will be raised.

Instance Methods
 
__init__(self, message_factory)
 
setLatency(self, latency)
 
processMessageAck(self, message_id)
 
parsePacket(self, packet_bytes)
Parse a raw udp packet and return a list of parsed messages.
 
processInboundPacket(self, packet_bytes)
Pass raw udp packet data to this method.
 
sendMessage(self, message, ordered=False, reliable=False)
Send a message and specify any options for the send method used.
 
sendReliableMessage(self, message)
Send a message that is guaranteed to be delivered.
 
sendInOrderMessage(self, message)
Send a message in the in-order channel.
 
hasOutgoingPackets(self)
Returns whether this buffer has any packets waiting to be sent.
 
update(self, sock, address)
Update this buffer by sending any messages in the output lists and read any messages which have been insert into the inputBuffer via the processInboundPacket call.
Class Variables
  MTU = 1400
  MESSAGE_TRANSPORT_HEADER = 'HHB'
  RECENT_MESSAGE_LIST_SIZE = 1000
Method Details

__init__(self, message_factory)
(Constructor)

 
Overrides: object.__init__
(inherited documentation)

processInboundPacket(self, packet_bytes)

 
Pass raw udp packet data to this method. Returns the number of packets parsed and inserted into the .incoming list.

sendMessage(self, message, ordered=False, reliable=False)

 
Send a message and specify any options for the send method used. A message sent inOrder is implicitly sent as reliable. message is an instance of a subclass of packets.BasePacket.

sendReliableMessage(self, message)

 
Send a message that is guaranteed to be delivered. message is an instance of a subclass of packets.BasePacket

sendInOrderMessage(self, message)

 
Send a message in the in-order channel. Any packets sent in-order will arrive in the order they were sent. message is an instance of a subclass of packets.BasePacket

update(self, sock, address)

 

Update this buffer by sending any messages in the output lists and read any messages which have been insert into the inputBuffer via the processInboundPacket call.

Returns a list of message instances of messages that were read.