TcpClient

For conceptual guidance on memory transport usage, see:

Python binding

This C++ class is also exported into Python as rogue.interfaces.memory.TcpClient.

Python API page: - TcpClient

objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::interfaces::memory::TcpClient> rogue::interfaces::memory::TcpClientPtr
[header]

Shared pointer alias for TcpClient.

The class description is shown below:

class TcpClient : public rogue::interfaces::memory::Slave
[header]

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.

Public Functions

TcpClient(std::string addr, uint16_t port, bool waitReady = false)
[header] [impl]

Constructs a TCP memory bridge client.

Creator.

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.

~TcpClient()
[header] [impl]

Destroys the TCP client and releases transport resources.

Destructor.

void close()
[header] [impl]

Closes bridge connections.

Deprecated; use stop().

virtual void stop()
[header] [impl]

Stops the bridge interface and worker thread.

bool waitReady(double timeout, double period)
[header] [impl]

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.

void start()
[header] [impl]

Managed-lifecycle startup hook.

If this instance was constructed with waitReady=true, _start() blocks until the bridge request/response path responds to a readiness probe. Otherwise it is a no-op.

virtual void doTransaction(std::shared_ptr<rogue::interfaces::memory::Transaction> tran)
[header] [impl]

Processes a transaction received from the upstream master.

Post a transaction.

Parameters:

tranTransaction to forward to the remote server.

Public Static Functions

static std::shared_ptr<rogue::interfaces::memory::TcpClient> create(std::string addr, uint16_t port, bool waitReady = false)
[header] [impl]

Creates a TCP memory bridge client.

Class creation.

Parameter semantics are identical to the constructor; see TcpClient() for address and port behavior details. Exposed as rogue.interfaces.memory.TcpClient() in Python. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters:
  • addr – Remote server address.

  • port – Base TCP port number.

  • waitReady – If true, configure the instance so _start() waits for bridge readiness before returning.

Returns:

Shared pointer to the created client.

static void setup_python()
[header] [impl]

Registers this type with Python bindings.