Base classes for equipment that is connected through a socket.
- class msl.equipment.connection_socket.ConnectionSocket(record)[source]
Base class for equipment that is connected through a socket.
propertiesfor a socket connection supports the following key-value pairs in the Connections Database (see also
socketfor more details):
'buffer_size': int, the maximum number of bytes to read at a time [default: 4096] 'encoding': str, the encoding to use [default: 'utf-8'] 'encoding_errors': str, encoding error handling scheme, e.g. 'strict', 'ignore' [default: 'strict'] 'family': str, the address family, e.g., 'INET', 'INET6', 'IPX' [default: 'INET'] 'max_read_size': int, the maximum number of bytes that can be read [default: 1 MB] 'proto': int, the socket protocol number [default: 0] 'read_termination': str or None, read until this termination sequence is found [default: '\n'] 'rstrip': bool, whether to remove trailing whitespace from "read" messages [default: False] 'socket_type': str, the socket type, e.g. 'STREAM', 'DGRAM' [default: 'STREAM'] 'termination': shortcut for setting both 'read_termination' and 'write_termination' to this value 'timeout': float or None, the timeout (in seconds) for read and write operations [default: None] 'write_termination': str or None, termination sequence appended to write messages [default: '\r\n']
backendvalue must be equal to
MSLto use this class for the communication system. This is achieved by setting the value in the Backend field for a connection record in the Connections Database to be
Do not instantiate this class directly. Use the
connect()method to connect to the equipment.
EquipmentRecord) – A record from an Equipment-Register Database.
MSLConnectionError – If the socket cannot be opened.
- static parse_address(address)[source]
Get the host and port from an address.
str) – The address of a
None– The value of the host and the port or
Noneif address is not valid for a socket.
Reconnect to the equipment.