ConnectCommand
- class mtf.network_port.tls.tls_helpers.ConnectCommand
Object used to initiate a TCP connection to a server.
This class handles the creation of a TCP socket and connects to a specified server, setting up the necessary configurations for further communication.
- __init__(src_address: str, src_port: int, dst_address: str, dst_port: int, version: tuple, timeout: float)
Initializes the connection parameters.
This method sets up the necessary parameters for establishing a network connection, including source and destination addresses and ports, protocol version, and timeout settings.
- Args:
src_address (str): The hostname or IP address of the source. src_port (int): The TCP port number to connect from. dst_address (str): The hostname or IP address of the server to connect to. dst_port (int): The TCP port number on the server to connect to. version (Optional[tuple], optional): The protocol version used in the TLS record layer
for the initial handshake messages. Defaults to the value specified in TLSConfigurator.record_version.
- timeout (float, optional): The timeout in seconds for the connection and subsequent
read/write operations. Defaults to the value specified in TLSConfigurator.time_out.
- Returns:
None: This method does not return a value.
- process(state: ConnectionState)
Establishes a connection to the server and prepares the socket for message exchange.
This method creates a TCP socket, connects to the specified server, and sets up the necessary socket options, such as disabling Nagle’s algorithm. It also wraps the socket in a BufferedSocket for more efficient I/O operations and sets up a Defragmenter for handling message fragmentation.
- Parameters:
state – An object representing the current state of the connection, where the connected socket and protocol version will be stored.
- cleanup()
Cleans up resources such as sockets to prevent resource leaks.
- add_child(child)
Sets the parameter as the child of the node
- Returns:
the child node
- get_all_siblings()
Return iterator with all siblings of node
- Return type:
iterator
- is_command()
Define object as a command node.
- is_expect()
Define object as a command node.
- is_generator()
Define object as a command node.