pex.proto.tlv.client

Module Contents

class pex.proto.tlv.client.TLVClient(client: socket.socket, endian: str = 'little', max_size: int = 4096)

Bases: object

Subclass of pex.proto.tlv module.

This subclass of pex.proto.tlv module represents Python implementation of the TLV client.

close() None

Close connected socket.

Return None:

None

send(packet: pex.proto.tlv.packet.TLVPacket) None

Send TLV packet to the socket.

Parameters:

packet (TLVPacket) – TLV packet

Return None:

None

read() pex.proto.tlv.packet.TLVPacket

Read TLV packet from the socket.

Return TLVPacket:

read TLV packet

Raises:

RuntimeError – with trailing error message

send_raw(data: bytes) None

Send raw data instead of TLV packet.

Parameters:

data (bytes) – data to send

Return None:

None

Raises:

RuntimeError – with trailing error message

read_raw(size: int) bytes

Read raw data instead of TLV packet.

Parameters:

size (int) – size of data to read

Return bytes:

read data

Raises:

RuntimeError – with trailing error message