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
Slaveinterface 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
TcpServerhost (IP or hostname). The bridge uses two consecutive TCP ports starting atport; for example,port=8000uses ports8000and8001.This constructor is a low-level C++ allocation path. Prefer
create()when shared ownership or Python exposure is required.waitReadydoes 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.
-
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
TcpServerto 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:
trueif the probe succeeds before timeout, otherwisefalse.
-
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.
Processes a transaction received from the upstream master.
Post a transaction.
- Parameters:
tran – Transaction 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 asrogue.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 returnsstd::shared_ptrownership 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.