src.core.utils package

Submodules

src.core.utils.exc module

Module containing exceptions raised in various scenarios during execution of both client and server programs.

exception src.core.utils.exc.ProtocolError(*args)[source]

Bases: exceptions.Exception

Raised when any one of the parties observes that the other one does not follow the protocol.

exception src.core.utils.exc.ServerUnreachableError(*args)[source]

Bases: exceptions.Exception

Raised in a situation when the server cannot be reached due to any reason.

exception src.core.utils.exc.UnrecognizedVariableError(*args)[source]

Bases: exceptions.KeyError

Raised when during the access to a configuration variable a wrong name is provided.

exception src.core.utils.exc.VariableNotSettableError(*args)[source]

Bases: exceptions.Exception

Raised when the configuration variable, which is not marked as settable is being set.

src.core.utils.net_utils module

Module containing network utilities shared by both client and server.

src.core.utils.net_utils.receive(sock, size=1024)[source]

Receive a message via UDP socket.

Calls socket.recvfrom() function from the socket module.

Parameters:
  • sock (socket.socket) – opened UDP socket
  • size (int) – number of bytes to receive, defaults to 1024
Returns:

A received message and the sender’s endpoint data, represented by a tuple of address string and port integer value.

src.core.utils.net_utils.send(sock, msg_name, *recvs)[source]

Send a message via UDP socket.

Send a message to any number of recipients. Calls socket.sendto() function from the socket module.

Parameters:
  • sock (socket.socket) – opened UDP socket
  • msg_name (str) – string value of the name of the message to send
  • recvs – any number of endpoints (str address, int port) of the receivers

Module contents

Module containing core utilities for both client and server programs.