MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Portal::Network::NetworkSink Class Reference

Owned handle for sending data through a network stream. More...

#include <NetworkSink.hpp>

+ Collaboration diagram for MayaFlux::Portal::Network::NetworkSink:

Public Member Functions

bool is_open () const
 Return true if the endpoint was opened successfully.
 
const std::string & name () const
 Return the stream name from the config.
 
 NetworkSink (const NetworkSink &)=delete
 
 NetworkSink (const StreamConfig &config)
 Open a send endpoint from a StreamConfig.
 
 NetworkSink (NetworkSink &&) noexcept
 
NetworkSinkoperator= (const NetworkSink &)=delete
 
NetworkSinkoperator= (NetworkSink &&) noexcept
 
bool send (ByteView data) const
 Send bytes through this sink's endpoint.
 
bool send_to (ByteView data, const std::string &address, uint16_t port) const
 Send bytes to an explicit address, overriding the config target.
 
 ~NetworkSink ()
 Close the endpoint and release resources.
 

Private Attributes

uint64_t m_endpoint_id { 0 }
 
std::string m_name
 
Registry::Service::NetworkServicem_service { nullptr }
 

Detailed Description

Owned handle for sending data through a network stream.

NetworkSink is the send-side counterpart to Vruta::NetworkSource. It owns one endpoint opened via NetworkService and exposes send and send_to as the only public interface.

Lifetime matches the stream: the endpoint is opened on construction and closed on destruction. Move-only.

Consumers hold a shared_ptr<NetworkSink>. A metro coroutine, a node output callback, or a future Portal::Network::PacketFlow all hold the same handle. The underlying transport is hidden behind NetworkFoundry — callers never touch NetworkService directly.

Today NetworkFoundry is a thin wrapper over NetworkService. When WebRTC or QUIC arrives, only NetworkFoundry changes.

auto sink = std::make_shared<Portal::Network::NetworkSink>(
.name = "osc_out",
.endpoint = { .address = "127.0.0.1", .port = 9000 },
.profile = StreamProfile::CONTROL,
});
sink->send(payload);
sink->send_to(payload, "192.168.1.5", 9001);
@ UDP
Low-latency, unordered datagrams. OSC, control, sparse streams.
Full configuration for an outbound or bidirectional stream.

Definition at line 43 of file NetworkSink.hpp.


The documentation for this class was generated from the following files: