Comms

This module implements the Socket communication.

class TcpSocket(host=None, port=None, eol=b'\\n', timeout=30.0, logger=None)

Socket communication class to access raw socket layer using TCP protocol.

Example:

from comms import TcpSocket sock = TcpSocket(”tcp://127.0.0.1:45678”)

class UdpSocket(host=None, port=None, eol=b'\\n', timeout=30.0, logger=None)

Socket communication class to access raw socket layer using UDP protocol.

Example:

from comms import UdpSocket sock = UdpSocket(“udp://127.0.0.1:45678”)

parse_url(url)

Parse the url string into component host & port.

Parameters:

url (str) – an encoded string containing host, port and socket type

Raises:

ValueError – invalid URL specified

Return type:

tuple[str, int]

Returns:

the decoded host & port