TcpClient
Examples of using a TCP stream bridge are described in Using The TCP Bridge.
TcpClient objects in C++ are referenced by the following shared pointer typedef:
-
typedef std::shared_ptr<rogue::interfaces::stream::TcpClient> rogue::interfaces::stream::TcpClientPtr
Shared pointer alias for
TcpClient.
The class description is shown below:
-
class TcpClient : public rogue::interfaces::stream::TcpCore
Stream TCP bridge client.
Thin wrapper around
TcpCoreconfigured for client mode.Public Functions
-
TcpClient(std::string addr, uint16_t port)
Constructs a TCP stream bridge client.
This constructor is a low-level C++ allocation path. Prefer
create()when shared ownership or Python exposure is required.The constructor takes an address and port. The remote server address can be an IP address or hostname. The bridge uses two consecutive TCP ports;
portis the base (for example,port=8000uses8000and8001).- Parameters:
addr – Remote server address.
port – Base TCP port number.
-
~TcpClient()
Destroys the TCP client.
Public Static Functions
-
static std::shared_ptr<rogue::interfaces::stream::TcpClient> create(std::string addr, uint16_t port)
Creates a TCP stream bridge client and return as TcpClientPtr.
Parameter semantics are identical to the constructor; see
TcpClient()for address and port behavior details. Exposed in Python asrogue.interfaces.stream.TcpClient. 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.
- Returns:
Shared pointer to the created client.
-
static void setup_python()
Registers this type with Python bindings.
-
TcpClient(std::string addr, uint16_t port)