Server

TODO

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

typedef std::shared_ptr<rogue::protocols::udp::Server> rogue::protocols::udp::ServerPtr

The class description is shown below:

class Server : public rogue::protocols::udp::Core, public rogue::interfaces::stream::Master, public rogue::interfaces::stream::Slave

UDP stream endpoint that listens on a local UDP port.

Server combines UDP transport (udp::Core) with Rogue stream interfaces:

  • stream::Slave: accepts outbound frames and transmits datagrams to the most recently seen remote endpoint.

  • stream::Master: emits inbound datagrams as Rogue frames.

A background receive thread listens on the bound UDP socket, forwards payloads as frames, and updates remote endpoint address when packets are received.

Public Functions

Server(uint16_t port, bool jumbo)

Constructs a UDP server endpoint.

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

Creates and binds UDP socket, initializes frame pool sizing, and starts background receive thread. If port == 0, the OS-assigned port is queried and stored.

Parameters:
  • port – Local UDP port to bind (0 requests dynamic port assignment).

  • jumbotrue for jumbo payload sizing; false for standard MTU.

~Server()

Destroys the UDP server endpoint.

virtual void stop()

Stops the UDP server endpoint.

Stops receive thread, joins thread, and closes socket.

uint32_t getPort()

Returns bound local UDP port number.

Returns:

Local UDP port.

virtual void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)

Accepts an outbound stream frame and transmits it as UDP datagrams.

Datagrams are sent to the current remote endpoint address learned by the receive thread. Writes use select() with configured timeout.

Parameters:

frame – Outbound frame to transmit.

Public Static Functions

static std::shared_ptr<rogue::protocols::udp::Server> create(uint16_t port, bool jumbo)

Creates a UDP server endpoint.

Parameter semantics are identical to the constructor; see Server() for endpoint setup behavior details. 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:
  • port – Local UDP port to bind (0 requests dynamic port assignment).

  • jumbotrue for jumbo payload sizing; false for standard MTU.

Returns:

Shared pointer to the created server.

static void setup_python()

Registers Python bindings for this class.