TcpServer

Examples of using a TCP stream bridge are described in Using The TCP Bridge.

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

typedef std::shared_ptr<rogue::interfaces::stream::TcpServer> rogue::interfaces::stream::TcpServerPtr

Alias for using shared pointer as TcpServerPtr.

The class description is shown below:

class TcpServer : public rogue::interfaces::stream::TcpCore

Stream TCP bridge server.

Thin wrapper around TcpCore configured for server mode.

Public Functions

TcpServer(std::string addr, uint16_t port)

Constructs a TCP stream bridge server.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

The address can be an IP address or hostname and selects the local bind interface. A value of "*" binds all interfaces. The bridge uses two consecutive TCP ports; port is the base (for example, port=8000 uses 8000 and 8001).

Parameters:
  • addr – Local bind address.

  • port – Base TCP port number.

~TcpServer()

Destroys the TCP server.

Public Static Functions

static std::shared_ptr<rogue::interfaces::stream::TcpServer> create(std::string addr, uint16_t port)

Factory method to create a TCP stream bridge server.

Parameter semantics are identical to the constructor; see TcpServer() for address and port behavior details. Exposed in Python as rogue.interfaces.stream.TcpServer. 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 – Interface address for the server.

  • port – Base TCP port number for the bridge.

Returns:

Shared pointer (TcpServerPtr) to the created server.

static void setup_python()

Registers this type with Python bindings.