UDP Sender

class gpype.backend.sinks.udp_sender.UDPSender[source]

Bases: INode

UDP sink node for real-time data transmission.

Transmits data as float64 numpy arrays via UDP packets to a configurable target address. Each step() sends one packet with direct transmission.

DEFAULT_IP = '127.0.0.1'

Default target IP address (localhost)

DEFAULT_PORT = 56000

Default target UDP port number

class Configuration[source]

Bases: Configuration

Configuration class for UDPSender parameters.

class Keys[source]

Bases: Keys

Configuration keys for UDP sender settings.

IP = 'ip'

IP address configuration key

PORT = 'port'

Port number configuration key

__init__(ip=None, port=None, **kwargs)[source]

Initialize UDP sender with target address and port.

Parameters:
  • ip (Optional[str]) – Target IP address. Defaults to localhost if None.

  • port (Optional[int]) – Target port number. Defaults to DEFAULT_PORT if None.

  • **kwargs – Additional arguments for parent INode.

start()[source]

Start UDP sender and initialize socket connection.

Creates UDP socket and configures target address from configuration.

Raises:

OSError – If socket creation fails.

stop()[source]

Stop UDP sender and clean up socket resources.

setup(data, port_context_in)[source]

Setup method for pipeline initialization.

Parameters:
  • data (dict[str, ndarray]) – Input data arrays from connected ports.

  • port_context_in (dict[str, dict]) – Context information from input ports.

Return type:

dict[str, dict]

Returns:

Empty dictionary (sink node has no output context).

step(data)[source]

Process and transmit data via UDP.

Converts data to float64, serializes to bytes, and sends via UDP.

Parameters:

data (dict[str, ndarray]) – Input data arrays. Uses default input port.

Return type:

dict[str, ndarray]

Returns:

Empty dictionary (sink node has no output).