14. cc_udp_server

14.1. Communication Channel via UDP server

module

cc_udp_server

synopsis

basic UDP server

Warning

if multiple clients are connected to this server, ensure that each client receives all necessary responses before receiving messages again. Otherwise the responses may be sent to the wrong client

class pykiso.lib.connectors.cc_udp_server.CCUdpServer(dest_ip, dest_port, **kwargs)[source]

Connector channel used to set up an UDP server.

Initialize attributes.

Parameters
  • dest_ip (str) – destination port

  • dest_port (int) – destination port

_cc_close()[source]

Close UDP socket.

Return type

None

_cc_open()[source]

Bind UDP socket with configured port and IP address.

Return type

None

_cc_receive(timeout=1e-07, raw=False)[source]

Read message from UDP socket.

Parameters
  • timeout – timeout applied on receive event

  • raw (bool) – should the message be returned raw or should it be interpreted as a pykiso.Message?

Return type

Dict[str, Union[Message, bytes, None]]

Returns

Message if successful, otherwise none

_cc_send(msg, raw=False)[source]

Send back a UDP message to the previous sender.

Parameters

msg (bytes) – message instance to serialize into bytes

Return type

None