Class BroadcastSender
Sends UDP broadcast packets with optional periodic modes. Modes:
- LoopSingle: repeat the same message at a fixed interval.
- UntilResponse: repeat until a response is observed (subscribe to a BroadcastService instance).
- RetryOnFailure: re-send only when local send throws; limited attempts.
public class BroadcastSender : IDisposable
- Inheritance
-
BroadcastSender
- Implements
- Inherited Members
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Start(string, int, PeriodicMode, int, int, BroadcastService)
Start periodic sending in the selected mode. For UntilResponse, pass a listening service; when it raises OnResponseReceived the sender stops.
public void Start(string message, int port, BroadcastSender.PeriodicMode mode, int intervalMs = 1000, int maxRetries = 3, BroadcastService listenService = null)
Parameters
messagestringportintmodeBroadcastSender.PeriodicModeintervalMsintmaxRetriesintlistenServiceBroadcastService
Stop()
public void Stop()