TcpCore

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

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

typedef std::shared_ptr<rogue::interfaces::stream::TcpCore> rogue::interfaces::stream::TcpCorePtr

Alias for using shared pointer as TcpCorePtr.

The class description is shown below:

class TcpCore : public rogue::interfaces::stream::Master, public rogue::interfaces::stream::Slave

Stream TCP Bridge Core.

This class implements the core functionality of the TcpClient and TcpServer classes which implement a Rogue stream bridge over a TCP network. This core can operation in either client or server mode. The TcpClient and TcpServer classes are thin wrapper which define which mode flag to pass to this base class.

The TcpServer and TcpClient interfaces are blocking and will stall frame transmissions when the remote side is either not present or is back pressuring. When the remote server is not present a local buffer is not utilized, where it is utilized when a connection has been established.

Subclassed by rogue::interfaces::stream::TcpClient, rogue::interfaces::stream::TcpServer

Public Static Functions

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

Create a TcpCore object and return as a TcpCorePtr.

The creator takes an address, port and server mode flag. The passed address can either be an IP address or hostname. When running in server mode the address string defines which network interface the socket server will listen on. A string of “*” results in all network interfaces being listened on. The stream bridge requires two TCP ports. The passed port is the base number of these two ports. A passed value of 8000 will result in both 8000 and 8001 being used by this bridge.

Not exposed to Python

Parameters:
  • addr – Interface address for server, remote server address for client.

  • port – Base port number of use for connection.

  • server – Server flag. Set to True to run in server mode.

Returns:

TcpCore object as a TcpCorePtr