pokerthproto.transport module

The low-level transport functionality for packing/unpacking and enveloping/ developing messages.

pokerthproto.transport.develop(envelope)[source]

Remove the envelope from a message.

Parameters:envelope – PokerTHMessage object that envelops a message
Returns:PokerTH message from the envelope
pokerthproto.transport.envelop(msg)[source]

Put a message into an envelope.

Parameters:msg – PokerTH message object
Returns:message wrapped in a PokerTHMessage object
pokerthproto.transport.makeSizeBytes(n)[source]

Create a 4 bytes string that encodes the number n.

Parameters:n – integer
Returns:4 bytes string
pokerthproto.transport.pack(envelope)[source]

Packs/Serializes a PokerTHMessage to a data string.

Parameters:envelope – PokerTHMessage envelope
Returns:data as string
pokerthproto.transport.readSizeBytes(string)[source]

Reads the 4 byte size-string and returns the size as integer.

Parameters:string – 4 byte size-string
Returns:integer
pokerthproto.transport.unpack(data)[source]

Unpacks/Deserializes a PokerTH network messsage.

Parameters:data – data as string
Returns:PokerTHMessage object containing the message