11. cc_tcp_ip

11.1. Communication Channel via socket

module

cc_socket

synopsis

connector for communication via socket

class pykiso.lib.connectors.cc_tcp_ip.CCTcpip(dest_ip, dest_port, max_msg_size=256, **kwargs)[source]

Connector channel used to communicate via socket

Initialize channel settings.

Parameters
  • dest_ip (str) – destination ip address

  • dest_port (int) – destination port

  • max_msg_size (int) – the maximum amount of data to be received at once

_cc_close()[source]

Close UDP socket.

Return type

None

_cc_open()[source]

Connect to socket with configured port and IP address.

Return type

None

_cc_receive(timeout=0.01, raw=False)[source]

Read message from socket.

Parameters
  • timeout – time in second to wait for reading a message

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

Return type

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

Returns

Message if successful, otherwise none

_cc_send(msg, raw=False)[source]

Send a message via socket.

Parameters
  • msg (bytes) – message to send

  • raw (bool) – is the message in a raw format (True) or is it a string (False)?

Return type

None