Server

Server is the UDP bind/listen endpoint class and supports querying the active bound port via getPort(). This page is reference-only; for usage patterns see UDP Protocol Server.

Python binding

This C++ class is also exported into Python as rogue.protocols.udp.Server.

Python API page: - Server

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

typedef std::shared_ptr<rogue::protocols::udp::Server> rogue::protocols::udp::ServerPtr
[header]

The class description is shown below:

class Server : public rogue::protocols::udp::Core, public rogue::interfaces::stream::Master, public rogue::interfaces::stream::Slave
[header] [source]

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)
[header] [impl]

Constructs a UDP server endpoint.

Creator.

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()
[header] [impl]

Destroys the UDP server endpoint.

Destructor.

virtual void stop()
[header] [impl]

Stops the UDP server endpoint.

Stops receive thread, joins thread, and closes socket.

uint32_t getPort()
[header] [impl]

Returns bound local UDP port number.

Get port number.

Returns:

Local UDP port.

virtual void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)
[header] [impl]

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

Accept a frame from master.

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)
[header] [impl]

Creates a UDP server endpoint.

Class creation.

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.

Company : SLAC National Accelerator Laboratory

Description: UDP

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE.txt file.

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()
[header] [impl]

Registers Python bindings for this class.