UDP Polygon
An opiniated UDP listener and publisher
Breaking Changes
From 0.1.1 to 0.2.0 Previously, versions below 0.1.1 were converting the received datagram bytes into a string. However, starting from version 0.2.0 and onwards, the receive event now delivers the bytes directly. The change was implemented because the previous implementation was found to be too restrictive.
Requirements
- the consumer requires tokio
- a producer does not require anything extra
- a producer with the timer flag enabled requires tokio
Configuration
There are many options on configuring your UDP client and server
- TOML file
[[]]
= "127.0.0.1"
= 5061
[]
= "127.0.0.1"
= 5060
- Arguments
let config = from_arguments;
- Enviroment variables
let config = from_env;
Send
polygon.send;
Receive
let rx = polygon.receive;
loop
Basic Examples
- send_fa (example by passing arguments)
- receive_fa (example by passing arguments)
- send_toml (example by using a toml file)
- receive_toml (example by using a toml file)
Timer flag
Retransmits a message with specific delays
polygon.send_with_timer;
retransmissions can be paused at any given time, even mid sending a message, effectively cancelling a retransmission
let mut polygon = configure;
let pause = clone;
*pause.lock.unwrap = true;
or
let mut polygon = configure;
polygon.pause_timer_send
polygon.resume_timer_send
this will make the send_with_timer to behave like a normal send (only it would still require tokio)
Timer Examples
- send_with_timer