TcpClient

For conceptual usage, see:

Implementation

This Python API is provided by a Rogue C++ class exported into Python.

Native C++ class: - TcpClient

Generated API

class rogue.interfaces.memory.TcpClient(addr, port, waitReady)

C++: rogue::interfaces::memory::TcpClient

Binding source: [TcpClient.cpp]

Memory TCP bridge client.

Bridges a local memory transaction source to a remote TcpServer. The client accepts transactions through its Slave interface and sends them over a two-socket request/response transport (base port and base port + 1). Non-posted transactions are tracked by transaction ID until a response is received by the background thread. Operational behavior:

  • Write/Post transactions include payload bytes in the outbound message.

  • Read/Verify transactions send metadata and receive payload bytes in the response.

  • Posted writes are completed locally after send (no response wait).

  • If the remote side is unavailable or send path is backpressured, sends may fail and in-flight transactions can time out at higher layers.

__init__(addr, port, waitReady)

C++: rogue::interfaces::memory::TcpClient

Constructs a TCP memory bridge client.

The address is the remote TcpServer host (IP or hostname). The bridge uses two consecutive TCP ports starting at port; for example, port=8000 uses ports 8000 and 8001. This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required. waitReady does not block in the constructor itself; it configures whether _start() should perform readiness probing later.

Parameters:
  • addr – Remote server address.

  • port – Base TCP port number.

  • waitReady – If true, record that _start() should block until the bridge request/response path responds to a readiness probe.

close()

C++: rogue::interfaces::memory::TcpClient::close()

Closes bridge connections.

Deprecated; use stop().

waitReady(timeout, period)

C++: rogue::interfaces::memory::TcpClient::waitReady()

Wait for the remote TcpServer path to respond to a bridge probe.

This sends a lightweight internal control transaction through the bridge and waits for the remote TcpServer to acknowledge it. It verifies that the request/response path is usable, which is stronger than a local socket-connect state.

Parameters:
  • timeout – Maximum wait time in seconds.

  • period – Retry period in seconds.

Returns:

true if the probe succeeds before timeout, otherwise false.

setName(name)

C++: rogue::interfaces::memory::Slave::setName()

Sets slave name.

Exposed to Python as setName.

Parameters:

name – New slave name string.

_addTransaction(transaction)

C++: rogue::interfaces::memory::Slave::addTransaction()

Adds a transaction to the internal tracking map.

This method is called by the sub-class to add a transaction into the local tracking map for later retrieval. This is used when the transaction will be completed later as the result of protocol data being returned to the Slave. Exposed to Python as _addTransaction().

Parameters:

transaction – Pointer to transaction as TransactionPtr.

_getTransaction(index)

C++: rogue::interfaces::memory::Slave::getTransaction()

Gets a transaction from the internal tracking map.

This method is called by the sub-class to retrieve an existing transaction using the unique transaction ID. If the transaction exists in the list the pointer to that transaction will be returned. If not a NULL pointer will be returned. When getTransaction() is called the map will also be checked for stale transactions which will be removed from the map. Exposed to Python as _getTransaction().

Parameters:

index – ID of transaction to lookup.

Returns:

Pointer to transaction as TransactionPtr or NULL if not found.

_doMinAccess()

C++: rogue::interfaces::memory::Slave::doMinAccess()

Returns minimum transaction access size.

Invokes the Python override when provided.

Returns:

Minimum transaction access size in bytes.

_doMaxAccess()

C++: rogue::interfaces::memory::Slave::doMaxAccess()

Returns maximum transaction access size.

Invokes the Python override when provided.

Returns:

Maximum transaction access size in bytes.

_doAddress()

C++: rogue::interfaces::memory::Slave::doAddress()

Returns base address contribution for this slave.

Invokes the Python override when provided.

Returns:

Address offset in bytes.

_doTransaction(transaction)

C++: rogue::interfaces::memory::Slave::doTransaction()

Services a transaction request from an attached master.

Invokes the Python override when provided.

Parameters:

transaction – Transaction object to process.

__lshift__(other)

C++: rogue::interfaces::memory::Slave::lshiftPy()

Supports << operator usage from Python.

Parameters:

p – Python object expected to provide a memory Master.

_stop()

C++: rogue::interfaces::memory::Slave::stop()

Stops the memory slave interface.

Base implementation is a no-op. Subclasses may override to stop worker threads or transport links.