smartinspectpython.sitcpprotocol
Module: sitcpprotocol.py
Revision History
Date | Version | Description |
---|---|---|
2023/05/30 | 3.0.0.0 | Initial Version. |
2023/06/09 | 3.0.8.0 | Added call to RaiseInfoEvent for the SI Console Server banner. |
Used for sending packets to the SmartInspect Console over a TCP socket connection.
This class is used for sending packets over a TCP connection to the Console. It is used when the 'tcp' protocol is specified in the SmartInspect.Connections property. Please see the IsValidOption method for a list of available protocol options.
For a list of available protocol options, please refer to the IsValidOption method.
Threadsafety:
The public members of this class are thread-safe.
Overridden. Fills a SIConnectionsBuilder instance with the options currently used by this protocol.
Arguments:
- builder (SIConnectionsBuilder): The SIConnectionsBuilder object to fill with the current options of this protocol.
Overridden. Validates if a protocol option is supported.
Arguments:
- name (str): The option name to validate.
Returns:
True if the option is supported and false otherwise.
The following table lists all valid options, their default values and descriptions for the TCP protocol.
Valid Options (default value) | Description |
---|---|
host ("127.0.0.1") | Specifies the TCP host name or ip address that the SI Console is listening on. |
port (4228) | Specifies the TCP port number that the SI Console is listening on. |
timeout (30000) | Specifies the connect, receive and send timeout in milliseconds. |
View Sample Code
from smartinspectpython.siauto import *
# the following are sample SI Connections options for this protocol.
# log messages using all default options (localhost, port 4228, 30s timeout).
SIAuto.Si.Connections = "tcp()"
# log messages using localhost, port 4228, 30s timeout, asynchronous processing.
SIAuto.Si.Connections = "tcp(host=localhost,port=4228,timeout=30000,reconnect=true,reconnect.interval=10s,async.enabled=true)
Overridden. Creates and connects a TCP socket.
This method tries to connect a TCP socket to a SmartInspect Console. The hostname and port can be specified by passing the "hostname" and "port" options to the Initialize method. Furthermore, it is possible to specify the connect timeout by using the "timeout" option.
Raises:
- Exception: Creating or connecting the socket failed.
Overridden. Closes the TCP socket connection.
This method closes the underlying socket handle if previously created and disposes any supplemental objects.
Raises:
- Exception: Closing the TCP socket failed.