plestylib.traffic.tcp_ip#
Classes#
A TrafficManager implementation for managing TCP/IP communication. |
Module Contents#
- class plestylib.traffic.tcp_ip.TCPIPTrafficManager(host, port, timeout=5, write_termination='\r\n', read_termination='\r\n')#
Bases:
plestylib.traffic.TrafficManagerA TrafficManager implementation for managing TCP/IP communication.
This class provides methods to open, close, and communicate with instruments over TCP/IP.
Initialize the TrafficManager with the given address and timeout.
- Parameters:
address (str) – The address of the resource.
timeout (int, optional) – The timeout for operations in seconds. Defaults to 5.
- host#
- port#
- write_termination = Multiline-String#
Show Value
""" """
- read_termination = Multiline-String#
Show Value
""" """
- _open(*args, **kwargs)#
Open the TCP/IP connection to the instrument.
- Parameters:
args – Positional arguments for the specific implementation (not used in this case).
kwargs – Keyword arguments for the specific implementation (not used in this case).
- _close()#
Close the connection to the resource.
This method should be implemented by subclasses to handle the specific details of closing the connection.
- receive_one(timeout=None)#
We leave this function public for direct use in some cases where the caller needs more control over the receiving process (e.g. in some requests, two responses might be expected, one for instant feedback and one for the final report when the operation is complete).
- _send_command(command: str, timeout=None, expect_response=True)#
Send a command to the resource and return the response.
- Parameters:
command (str) – The command to send.
timeout (int, optional) – The timeout for the command in seconds. Defaults to the instance’s timeout.
- Returns:
The response from the resource, or False if the command failed or timed out.
- Return type:
Any