by feschber · 2y ago · 0 comments
As for encryption I'm planning to use https://crates.io/crates/webrtc-dtls.
Udp also has the advantage of not needing to reconnect, which already makes it possible to switch between Wi-Fi and Ethernet seamlessly.
Maybe read this as "I recommend ..."
Udp also has other advantages besides speed. - Its session less, so any device going offline can simply come back online without needing to reestablish a tcp handshake. - The udp header is also substantially smaller than a tcp segment header (8 Bytes vs >= 20 Bytes). Not a huge difference but adds up to at least 12 KiB/s with a packet rate of 1000Hz and that is without the (potential) overhead of additional protocols like zmq or nng on top.
In this particular scenario the reliability of tcp is also not really necessary in my opinion.
I think overall it may be worth investigating if there is a noticeable difference.