### FEC Configuration Examples Source: https://context7.com/elisescu/udpcast/llms.txt Examples demonstrating Forward Error Correction (FEC) configuration for lossy networks. ```APIDOC ## FEC Configuration Examples ### Description Examples demonstrating Forward Error Correction (FEC) configuration for lossy networks. ### Code Examples ```bash # Heavy FEC for lossy networks - 8 stripes, 16 redundancy blocks udp-sender --file image.bin --async --fec 8x16/128 --max-bitrate 20m # High interleave for burst loss protection udp-sender --file image.bin --async --fec 16x8/64 --max-bitrate 30m ``` ``` -------------------------------- ### Udp-sender: Max Wait Example Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Demonstrates the --max-wait option for udp-sender, specifying the maximum time to wait for receivers before starting the transmission. ```bash udp-sender -f zozo --min-receivers 5 --min-wait 20 --max-wait 80 ``` -------------------------------- ### Udp-receiver: Pipe Command Example Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Shows how to use the --pipe option with udp-receiver to process received data through a command, such as decompression. ```bash udp-receiver -p "gzip -dc" ``` -------------------------------- ### Start Transmission with Minimum Receivers Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Automatically starts the sender once a specified minimum number of receivers have connected. Useful for unattended operation. ```bash --min-receivers n ``` -------------------------------- ### Basic File Broadcast with udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Broadcasts a file to listening receivers. Waits for receivers to connect before starting. ```bash udp-sender --file /path/to/disk.img ``` -------------------------------- ### Example Unidirectional Sender Command Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Use this command line for unidirectional transfers where a return channel is impractical. Ensure all unidirectional options are used together for correct operation. ```bash udp-sender --async --max-bitrate 10m --fec 8x8 ``` -------------------------------- ### Start Sender in Daemon Mode Source: https://context7.com/elisescu/udpcast/llms.txt Run udp-sender in daemon mode using --daemon-mode. --nokbd prevents keyboard interaction. Multiple --daemon-mode flags enable backgrounding and file descriptor closing. ```bash # Start sender in daemon mode (stays in foreground, restarts after each transfer) udp-sender --file image.bin --daemon-mode --nokbd ``` ```bash # Full daemon mode (backgrounds, closes file descriptors) udp-sender --file image.bin \ --daemon-mode --daemon-mode \ --pid-file /var/run/udpcast.pid ``` -------------------------------- ### Automated Reception with Timeouts using udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Configures automated reception with timeouts for starting and receiving, and disables keyboard interaction. ```bash udp-receiver --file output.bin \ --start-timeout 60 \ --receive-timeout 120 \ --nokbd ``` -------------------------------- ### Rate Governor Plugin API Source: https://context7.com/elisescu/udpcast/llms.txt Interface definition and example implementation for UDPCast rate governor plugins. ```APIDOC ## Rate Governor Plugin API ### Description UDPCast supports dynamically loadable rate governor modules to control transmission speed based on external factors like network congestion feedback. ### C Interface Definition ```c /* rateGovernor.h - Plugin interface for rate control */ typedef struct rateGovernor_t { /* Initialize rate governor instance, returns private data pointer */ void *(*rgInitialize)(void); /* Set configuration property (called for each key=value pair) */ void (*rgSetProp)(void *privateData, const char *key, const char *value); /* Called after all properties set - open sockets, start threads */ void (*rgEndConfig)(void *privateData); /* Called before each packet transmission - implement rate limiting here */ void (*rgWait)(void *privateData, int fd, in_addr_t ip, long bytes); /* Cleanup - close sockets, stop threads, free memory */ void (*rgShutdown)(void *privateData); } rateGovernor_t; ``` ### Example Implementation Skeleton ```c static void *my_initialize(void) { struct my_governor *gov = calloc(sizeof(struct my_governor), 1); gov->max_rate = 10000000; /* 10 Mbps default */ return gov; } static void my_setProp(void *p, const char *key, const char *value) { struct my_governor *gov = (struct my_governor *)p; if (!strcmp("rate", key)) { gov->max_rate = atol(value); } } static void my_wait(void *p, int fd, in_addr_t ip, long bytes) { struct my_governor *gov = (struct my_governor *)p; /* Calculate required delay based on bytes and max_rate */ usleep((bytes * 8 * 1000000) / gov->max_rate); } /* Export governor table for dynamic loading */ struct rateGovernor_t governor = { my_initialize, my_setProp, my_endConfig, my_wait, my_shutdown }; ``` ### Loading a Rate Governor Module ```bash # Loading a rate governor module udp-sender --file data.bin \ --rate-governor /usr/lib/udpcast/ipe.so:ip=224.1.2.3,port=5555,maxFillLevel=80 ``` ``` -------------------------------- ### Set Minimum Wait Time Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Specifies the minimum wait time before starting a transmission. This option is used in conjunction with other keyboardless mode options. ```bash --min-wait t ``` -------------------------------- ### Automated Unattended Broadcast with udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Starts an unattended broadcast after a minimum number of receivers connect, with configurable wait times. ```bash udp-sender --file backup.tar \ --min-receivers 5 \ --min-wait 20 \ --max-wait 80 \ --nokbd ``` -------------------------------- ### Configure Streaming and Receiver Tuning Source: https://context7.com/elisescu/udpcast/llms.txt Enable streaming mode with --streaming and set --rehello-offset for late joiners. Configure receiver timeouts with --retries-until-drop and --start-timeout. ```bash # Streaming mode tuning - rehello offset for late-joining receivers udp-sender --file data.bin \ --streaming \ --rehello-offset 100 ``` ```bash # Receiver timeout and retry tuning udp-sender --file data.bin \ --retries-until-drop 5 \ --start-timeout 30 ``` -------------------------------- ### Reception with Logging and Statistics using udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Configures logging to a file and sets a statistics reporting period. ```bash udp-receiver --file disk.img \ --log /var/log/udpcast.log \ --stat-period 1000 ``` -------------------------------- ### Configure Sender Logging and Statistics Source: https://context7.com/elisescu/udpcast/llms.txt Set log file path with --log and statistics reporting intervals with --stat-period and --bw-period. Use --no-progress for silent operation. ```bash # Sender with full logging udp-sender --file data.bin \ --log /var/log/udpcast-sender.log \ --stat-period 1000 \ --bw-period 5 ``` ```bash # Silent operation - no progress display udp-sender --file data.bin --no-progress ``` -------------------------------- ### Basic File Reception with udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Receives broadcast data and writes it to a specified file. ```bash udp-receiver --file /path/to/received.img ``` -------------------------------- ### Apply a Rate Governor Module Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Applies a dynamically loadable rate governor to control transmission rate based on external criteria. Specify the module and its properties. ```bash --rate-governor module.so:key1=value1,key2=value2 ``` -------------------------------- ### Daemon Mode and Process Control Source: https://context7.com/elisescu/udpcast/llms.txt Instructions for running UDPCast in daemon mode and controlling processes. ```APIDOC ## Daemon Mode and Process Control ### Description UDPCast can run as a daemon for continuous file serving with proper process management. ### Start Sender in Daemon Mode (Foreground Restart) ```bash # Start sender in daemon mode (stays in foreground, restarts after each transfer) udp-sender --file image.bin --daemon-mode --nokbd ``` ### Full Daemon Mode (Background) ```bash # Full daemon mode (backgrounds, closes file descriptors) udp-sender --file image.bin \ --daemon-mode --daemon-mode \ --pid-file /var/run/udpcast.pid ``` ### Gracefully Shutdown Daemon ```bash # Gracefully shutdown daemon (waits for current transfer to complete) udp-sender --kill --pid-file /var/run/udpcast.pid ``` ``` -------------------------------- ### Configure Receiver Logging and Statistics Source: https://context7.com/elisescu/udpcast/llms.txt Specify log file with --log and statistics interval with --stat-period. Use --no-progress for silent operation. ```bash # Receiver with logging udp-receiver --file data.bin \ --log /var/log/udpcast-receiver.log \ --stat-period 500 ``` ```bash # Silent operation - no progress display udp-receiver --file data.bin --no-progress ``` -------------------------------- ### Light FEC Configuration with udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Applies light Forward Error Correction (FEC) with 4 stripes, 4 redundancy blocks, and 64 data blocks per stripe, limiting bitrate to 50 Mbps. ```bash # FEC format: --fec x/ # interleave: number of stripes per slice (burst loss protection) # redundancy: FEC blocks per stripe (random loss protection) # stripesize: data blocks per stripe (max 128) # Light FEC - 4 stripes, 4 redundancy blocks, 64 data blocks per stripe udp-sender --file image.bin --async --fec 4x4/64 --max-bitrate 50m ``` -------------------------------- ### Logging and Statistics Source: https://context7.com/elisescu/udpcast/llms.txt Options for configuring logging and statistics reporting. ```APIDOC ## Logging and Statistics ### Description Both sender and receiver support detailed logging and progress reporting for monitoring transmission status. ### Sender Logging ```bash # Sender with full logging udp-sender --file data.bin \ --log /var/log/udpcast-sender.log \ --stat-period 1000 \ --bw-period 5 ``` ### Receiver Logging ```bash # Receiver with logging udp-receiver --file data.bin \ --log /var/log/udpcast-receiver.log \ --stat-period 500 ``` ### Silent Operation ```bash # Silent operation - no progress display udp-sender --file data.bin --no-progress udp-receiver --file data.bin --no-progress ``` ### Uncompressed Position Printing ```bash # Control uncompressed position printing udp-sender --file /dev/sda --pipe "gzip -c" --print-uncompressed-position 1 ``` ``` -------------------------------- ### Tune Slice and Block Sizes Source: https://context7.com/elisescu/udpcast/llms.txt Adjust --default-slice-size, --min-slice-size, and --max-slice-size for retransmission efficiency. Use -b to set block size. ```bash # Slice size tuning (blocks per slice) # Larger slices = fewer retransmission cycles, but more data to retransmit on loss udp-sender --file data.bin \ --default-slice-size 512 \ --min-slice-size 32 \ --max-slice-size 1024 ``` ```bash # Block size adjustment (default and max is 1456 bytes) udp-sender --file data.bin -b 1400 ``` -------------------------------- ### Slice and Block Tuning Source: https://context7.com/elisescu/udpcast/llms.txt Parameters for tuning slice and block sizes to optimize performance. ```APIDOC ## Slice and Block Tuning ### Description UDPCast organizes data into slices (groups of blocks) for efficient retransmission handling. Tuning these parameters optimizes performance for different network conditions. ### Slice Size Tuning ```bash # Slice size tuning (blocks per slice) # Larger slices = fewer retransmission cycles, but more data to retransmit on loss udp-sender --file data.bin \ --default-slice-size 512 \ --min-slice-size 32 \ --max-slice-size 1024 ``` ### Block Size Adjustment ```bash # Block size adjustment (default and max is 1456 bytes) udp-sender --file data.bin -b 1400 ``` ### Streaming Mode Tuning ```bash # Streaming mode tuning - rehello offset for late-joining receivers udp-sender --file data.bin \ --streaming \ --rehello-offset 100 ``` ### Receiver Timeout and Retry Tuning ```bash # Receiver timeout and retry tuning udp-sender --file data.bin \ --retries-until-drop 5 \ --start-timeout 30 ``` ``` -------------------------------- ### Using TTL for Multi-hop Multicast Source: https://context7.com/elisescu/udpcast/llms.txt Configures Time-To-Live (TTL) for multicast packets to allow them to traverse multiple network hops. ```bash udp-sender --file data.bin --ttl 32 --mcast-rdv-address 224.0.1.100 udp-receiver --file data.bin --ttl 32 --mcast-rdv-address 224.0.1.100 ``` -------------------------------- ### Load Rate Governor Module Source: https://context7.com/elisescu/udpcast/llms.txt Load a custom rate governor module using the --rate-governor option, specifying the module path and connection parameters. ```bash # Loading a rate governor module udp-sender --file data.bin \ --rate-governor /usr/lib/udpcast/ipe.so:ip=224.1.2.3,port=5555,maxFillLevel=80 ``` -------------------------------- ### Gracefully Shutdown Daemon Source: https://context7.com/elisescu/udpcast/llms.txt Use --kill with --pid-file to gracefully shut down a running UDPCast daemon, allowing the current transfer to complete. ```bash # Gracefully shutdown daemon (waits for current transfer to complete) udp-sender --kill --pid-file /var/run/udpcast.pid ``` -------------------------------- ### Broadcast with Compression Pipeline using udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Sends a compressed data stream by piping the file through a compression utility. ```bash udp-sender --file /dev/sda --pipe "gzip -c" ``` -------------------------------- ### Matching Portbase and Interface for Sender and Receiver Source: https://context7.com/elisescu/udpcast/llms.txt Ensures sender and receiver use the same portbase and network interface for communication. ```bash # Sender: udp-sender --file data.bin --portbase 9200 --interface eth0 # Receiver: udp-receiver --file data.bin --portbase 9200 --interface eth0 ``` -------------------------------- ### Receive and Decompress Data with udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Receives data and pipes it through a decompression utility before writing to a device. ```bash udp-receiver --file /dev/sda --pipe "gzip -dc" ``` -------------------------------- ### Daemon Mode Broadcast with udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Runs udp-sender in daemon mode to continuously serve files in the background, specifying a PID file. ```bash udp-sender --file system.img \ --daemon-mode --daemon-mode \ --pid-file /var/run/udpcast.pid ``` -------------------------------- ### Full-Duplex Broadcast with Custom Network Settings using udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Configures a full-duplex broadcast with a custom multicast address, portbase, and network interface. ```bash udp-sender --file data.bin \ --full-duplex \ --portbase 9100 \ --interface eth1 \ --mcast-data-address 239.1.2.3 \ --ttl 16 ``` -------------------------------- ### Rate Governor Plugin Interface (C) Source: https://context7.com/elisescu/udpcast/llms.txt Defines the interface for dynamic rate governor modules. Implement rgInitialize, rgSetProp, rgEndConfig, rgWait, and rgShutdown for custom rate limiting. ```c /* rateGovernor.h - Plugin interface for rate control */ typedef struct rateGovernor_t { /* Initialize rate governor instance, returns private data pointer */ void *(*rgInitialize)(void); /* Set configuration property (called for each key=value pair) */ void (*rgSetProp)(void *privateData, const char *key, const char *value); /* Called after all properties set - open sockets, start threads */ void (*rgEndConfig)(void *privateData); /* Called before each packet transmission - implement rate limiting here */ void (*rgWait)(void *privateData, int fd, in_addr_t ip, long bytes); /* Cleanup - close sockets, stop threads, free memory */ void (*rgShutdown)(void *privateData); } rateGovernor_t; /* Example implementation skeleton */ static void *my_initialize(void) { struct my_governor *gov = calloc(sizeof(struct my_governor), 1); gov->max_rate = 10000000; /* 10 Mbps default */ return gov; } static void my_setProp(void *p, const char *key, const char *value) { struct my_governor *gov = (struct my_governor *)p; if (!strcmp("rate", key)) { gov->max_rate = atol(value); } } static void my_wait(void *p, int fd, in_addr_t ip, long bytes) { struct my_governor *gov = (struct my_governor *)p; /* Calculate required delay based on bytes and max_rate */ usleep((bytes * 8 * 1000000) / gov->max_rate); } /* Export governor table for dynamic loading */ struct rateGovernor_t governor = { my_initialize, my_setProp, my_endConfig, my_wait, my_shutdown }; ``` -------------------------------- ### Reception on Specific Interface and Port with udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Specifies the network interface and portbase for receiving data. ```bash udp-receiver --file backup.img \ --interface eth1 \ --portbase 9100 ``` -------------------------------- ### Asynchronous Mode with FEC and Bandwidth Limiting using udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Uses asynchronous mode with Forward Error Correction (FEC) for unreliable networks and limits transmission to 10 Mbps. ```bash udp-sender --file image.bin \ --async \ --max-bitrate 10m \ --fec 8x8/128 ``` -------------------------------- ### Configure Retransmission of HELLO Packet Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Rebroadcasts the HELLO packet at a specified interval. Useful in async mode where receivers depend on the HELLO packet for information, or on networks with high packet loss. ```bash --rexmit-hello-interval timeout ``` -------------------------------- ### Configure FEC for Lossy Networks Source: https://context7.com/elisescu/udpcast/llms.txt Use --fec to specify stripes and redundancy blocks for error correction. Adjust --max-bitrate based on network capacity. ```bash udp-sender --file image.bin --async --fec 8x16/128 --max-bitrate 20m ``` ```bash udp-sender --file image.bin --async --fec 16x8/64 --max-bitrate 30m ``` -------------------------------- ### Receive Data to Standard Output with udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Receives broadcast data and outputs it to standard output, suitable for piping to other commands. ```bash udp-receiver | tar xvf - ``` -------------------------------- ### Broadcast Mode for Networks without Multicast Support Source: https://context7.com/elisescu/udpcast/llms.txt Enables broadcast mode for networks that do not support multicast. ```bash udp-sender --file data.bin --broadcast ``` -------------------------------- ### Streaming Mode Broadcast with udp-sender Source: https://context7.com/elisescu/udpcast/llms.txt Enables streaming mode, allowing receivers to join mid-transmission and setting a retransmission hello interval. ```bash udp-sender --file continuous_stream \ --streaming \ --rexmit-hello-interval 1000 ``` -------------------------------- ### Multimedia Mode Reception with udp-receiver Source: https://context7.com/elisescu/udpcast/llms.txt Enables multimedia mode to tolerate packet loss, filling gaps with random data. ```bash udp-receiver --file video_stream.dat \ --ignore-lost-data ``` -------------------------------- ### Point-to-Point Unicast Mode for Single Receiver Source: https://context7.com/elisescu/udpcast/llms.txt Configures sender to use point-to-point unicast mode for communication with a single receiver. ```bash udp-sender --file data.bin --pointopoint ``` -------------------------------- ### Set Retries Until Receiver Drop Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Defines how many times a REQACK is sent before a receiver is dropped. Lower values react faster to crashed receivers but increase false alerts for slow ones. ```bash --retries-until-drop retries ``` -------------------------------- ### Control Uncompressed Position Printing Source: https://context7.com/elisescu/udpcast/llms.txt Use --print-uncompressed-position to control the display of uncompressed data position, useful when piping through compression tools. ```bash # Control uncompressed position printing udp-sender --file /dev/sda --pipe "gzip -c" --print-uncompressed-position 1 ``` -------------------------------- ### Define UDPCast Protocol Opcodes Source: https://context7.com/elisescu/udpcast/llms.txt Defines the enumerated message types used for communication between UDPCast senders and receivers. These include commands for acknowledgments, data transfer, and connection management. ```c /* Protocol opcodes */ enum opCode { /* Receiver to sender */ CMD_OK, /* Acknowledgment - all blocks received */ CMD_RETRANSMIT, /* Request retransmission with bitmap */ CMD_GO, /* Signal sender to start transmission */ CMD_CONNECT_REQ, /* Discover sender address */ CMD_DISCONNECT, /* Receiver leaving */ /* Sender to receiver */ CMD_REQACK, /* Request acknowledgments */ CMD_CONNECT_REPLY, /* Reply to connection request */ CMD_DATA, /* Data block */ CMD_FEC, /* Forward error correction block */ CMD_HELLO_NEW, /* Sender announcement */ CMD_HELLO_STREAMING /* Retransmitted hello in streaming mode */ }; ``` -------------------------------- ### Configure Forward Error Correction Source: https://github.com/elisescu/udpcast/blob/master/cmd.html Enables forward error correction to compensate for lost packets in unidirectional mode. The format specifies interleave and redundancy, with an optional stripe size. ```bash --fec 8x8/128 ``` -------------------------------- ### Define UDPCast Capability Flags Source: https://context7.com/elisescu/udpcast/llms.txt Defines bitmask flags representing supported features in the UDPCast protocol. These flags indicate capabilities such as new protocol generations, FEC, byte order, and asynchronous transmission. ```c /* Capability flags */ #define CAP_NEW_GEN 0x0001 /* New generation protocol */ #define CAP_FEC 0x0004 /* Forward error correction */ #define CAP_BIG_ENDIAN 0x0008 /* Network byte order */ #define CAP_ASYNC 0x0020 /* Asynchronous transmission */ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.