Beemon Client

class client.Client(host_address: str | None = '127.0.0.1', host_listening_port: int | None = 65000, receive_size_bytes: int | None = 1024)[source]
close()[source]

Closes a connection from the client to a server.

Raises:

ConnectionError – Raises a ConnectionError in the event that the client is not connected to the server.

connect()[source]

Establishes a connection from the client to the server, commands will be sent via this channel.

Raises:

ConnectionError – Raises a ConnectionError in the event that the client fails to connect to the server.

send(message: str)[source]

Sends a message from the client to the server.

Note

This method requires that a pre-existing connection between the client and server has already been established. In order to establish a connection, call the connect method.

Parameters:

message

Todo

Docstring.

Raises:

ConnectionError – Raises a ConnectionError in the event that the client is not yet connected to the server.

send_receive(message: str) bytes[source]

Creates a connection to the server, sends the message, waits on a response, closes the connection, and returns the server’s response.

Parameters:

message

Todo

Docstring.

Returns:

The raw binary response received from the server.

Return type:

bytes

Raises:

ConnectionError – Raises a ConnectionError in the event that the client cannot connect to the server.

wait_receive() bytes[source]

Blocks program execution until a message is received from the server.

Returns:

The raw bytes received from the server.

Return type:

bytes

Raises:

ConnectionError – Raises a ConnectionError in the event that the client is not connected to the server.