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)[source]

Read message from UDP socket.

Parameters:

timeout – timeout applied on receive event

Return type:

Dict[str, Optional[bytes]]

Returns:

Message if successful, otherwise none

_cc_send(msg, **kwargs)[source]

Send back a UDP message to the previous sender.

Parameters:
  • msg (bytes) – message to sent, should be bytes

  • kwargs – not used

Return type:

None