Internal tcp/ip utilities

contains useful method for reading from and writing to socket

class Licel.TCP_util.util(ip: str, port: int)

the util class holds utilities method for socket communication. the class is to be inherited by licelTCP and licelTrTCP

readResponse() str

Read response from the command socket of the ethernet controller.

Returns:

response string

Return type:

str

Raises:

socket.timeout – if controller fails to respond within timeout period

recvall(nBins: int) bytearray | None

receive the number of nBins specified

Parameters:

nBins (int) – number of bins to read. Note that a bin consists of uint16, so the total number of received bytes equals 2* bins

Returns:

bytearray of size (2*nBins) containing the raw data, or None if connection closed

Return type:

Optional[bytearray]

writeCommand(command: str) None

Write the specified command to the ethernet controller.

Adds <CRLF> to each command before sending.

Parameters:

command (str) – command to send to the controller

Returns:

None

Return type:

None

See https://licel.com/manuals/ethernet_pmt_tr.pdf#section.9.1 for available commands.