TcpServer
For conceptual usage, see:
Implementation
This Python API is provided by a Rogue C++ class exported into Python.
Native C++ class: - TcpServer
Generated API
- class rogue.interfaces.memory.TcpServer(addr, port)
C++:
rogue::interfaces::memory::TcpServerBinding source: [TcpServer.cpp]
Memory TCP bridge server.
Implements the server side of the memory TCP bridge. The server receives request messages from remote
TcpClientinstances on a base port and returns completion/result messages on base port + 1. Each inbound request is translated into a local memory transaction executed through thisMasterinterface to the attached downstream slave path. Operational behavior:Request messages carry transaction ID, address, size, type, and optional write data.
Transactions are executed synchronously in the server worker thread.
Responses include returned read data (when applicable) and a status/result string.
The server must bind both bridge ports successfully; binding failures typically indicate address/port conflicts.
- __init__(addr, port)
C++:
rogue::interfaces::memory::TcpServerConstructs a TCP memory bridge server.
addrmay be a hostname, IP address, or"*"to bind on all interfaces. The bridge uses two consecutive TCP ports starting atport; for example,port=8000uses ports8000and8001. This constructor is a low-level C++ allocation path. Prefercreate()when shared ownership or Python exposure is required.- Parameters:
addr – Local bind address.
port – Base TCP port number.
- close()
C++:
rogue::interfaces::memory::TcpServer::close()Closes bridge connections.
Deprecated; use
stop().
- _setSlave(slave)
C++:
rogue::interfaces::memory::Master::setSlave()Sets the downstream slave or hub.
Transactions generated by this master are forwarded to this target. The target may be a leaf slave or a hub that forwards to lower levels. Exposed as
_setSlave()in Python.- Parameters:
slave – Downstream slave or hub pointer.
- _getSlave()
C++:
rogue::interfaces::memory::Master::getSlave()Returns the configured downstream slave or hub.
Exposed as
_getSlave()in Python.- Returns:
Downstream slave or hub pointer.
- _reqSlaveId()
C++:
rogue::interfaces::memory::Master::reqSlaveId()Queries the downstream slave ID.
Forwards the request to the lowest-level slave servicing this master path. This is used to determine which masters share an address space. Exposed as
_reqSlaveId()in Python.- Returns:
Unique 32-bit slave ID.
- _reqSlaveName()
C++:
rogue::interfaces::memory::Master::reqSlaveName()Queries the downstream slave name.
Forwards the request to the lowest-level slave servicing this master path. This allows the system to determine which memory Masters share an address space. Exposed as
_reqSlaveName()in Python.- Returns:
Slave name string.
- _reqMinAccess()
C++:
rogue::interfaces::memory::Master::reqMinAccess()Queries minimum access size in bytes for this interface path.
Request is forwared to the lowest-level slave to determine the minimum transaction size. Exposed as
_reqMinAccess()in Python.- Returns:
Minimum transaction size in bytes.
- _reqMaxAccess()
C++:
rogue::interfaces::memory::Master::reqMaxAccess()Queries maximum access size in bytes for this interface path.
Request is forwared to the lowest-level slave to determine the maximum transaction size. Exposed as
_reqMaxAccess()in Python.- Returns:
Maximum transaction size in bytes.
- _reqAddress()
C++:
rogue::interfaces::memory::Master::reqAddress()Queries the address offset of the next downstream layer.
Returns the relative offset of the connected slave/hub and does not include any local master offset. Exposed as
_reqAddress()in Python.- Returns:
Downstream relative address offset.
- _getError()
C++:
rogue::interfaces::memory::Master::getError()Returns the last transaction error string.
Exposed as
_getError()in Python.- Returns:
Error string for the last transaction sequence.
- _clearError()
C++:
rogue::interfaces::memory::Master::clearError()Clears the stored transaction error string.
Exposed as
_clearError()in Python.
- _setTimeout(timeout)
C++:
rogue::interfaces::memory::Master::setTimeout()Sets the timeout value for future transactions.
Timeout controls how long the master waits for transaction completion. Exposed as
_setTimeout()in Python.- Parameters:
timeout – Timeout value in microseconds. A value of
0leaves the current timeout unchanged.
- _reqTransaction()
C++:
rogue::interfaces::memory::Master::_reqTransaction()No binding docstring provided.
- _waitTransaction(id)
C++:
rogue::interfaces::memory::Master::waitTransaction()Waits for transaction completion or timeout.
Passing
0waits for all currently pending transactions. Exposed as_waitTransaction()in Python.- Parameters:
id – Transaction ID to wait for, or
0for all.
- _copyBits(dstData, dstLsb, srcData, srcLsb, size)
C++:
rogue::interfaces::memory::Master::copyBits()Copies bits between two byte arrays.
Copies
sizebits fromsrcDatastarting at bitsrcLsbintodstDatastarting at bitdstLsb. Bit numbering is least-significant-bit-first within each byte (bit 0 is the LSB of byte 0). The routine preserves destination bits outside the copied range and supports arbitrary unaligned source/destination bit offsets. When both offsets are byte-aligned, it uses a byte-copy fast path. This helper underpins variable packing/unpacking logic in the memory layer. Exposed as_copyBits()in Python.- Parameters:
dstData – Destination byte array.
dstLsb – Least-significant destination bit index.
srcData – Source byte array.
srcLsb – Least-significant source bit index.
size – Number of bits to copy.
- _setBits(dstData, lsb, size)
C++:
rogue::interfaces::memory::Master::setBits()Sets a contiguous bit range in a byte array.
Sets
sizebits to1indstDatastarting at bitlsb. Bit numbering is least-significant-bit-first within each byte (bit 0 is the LSB of byte 0). Bits outside the requested range are left unchanged. For byte-aligned regions, it uses a byte-fill fast path. This helper is used to build masks such as overlap and verify masks. Exposed as_setBits()in Python.- Parameters:
dstData – Destination byte array.
lsb – Least-significant bit index to set.
size – Number of bits to set.
- _anyBits(srcData, lsb, size)
C++:
rogue::interfaces::memory::Master::anyBits()Tests whether any bit in a range is set.
Checks
sizebits insrcDatastarting at bitlsband returnstrueif at least one bit is1. Bit numbering is least-significant-bit-first within each byte (bit 0 is the LSB of byte 0). This helper is commonly used for overlap and mask checks. Exposed as_anyBits()in Python.- Parameters:
srcData – Source byte array to check.
lsb – Least-significant bit index to check.
size – Number of bits to check.
- Returns:
trueif any bit in the range is set; otherwisefalse.
- __rshift__(other)
C++:
rogue::interfaces::memory::Master::rshiftPy()Supports
>>operator usage from Python.
- _stop()
C++:
rogue::interfaces::memory::Master::stop()Stops the interface and releases runtime resources.