Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You might take some inspiration (or some code) from https://github.com/htrefil/rkvm

I've used it and it works pretty well, is written in rust, and it has one big advantage - by emulating the keyboard and mouse at the linux evdev layer it avoids touching any of the desktop-specific apis. (It also has encryption, though over TCP so has issues with managing connections. I think your choice of UDP was a good one)



Definitely going to take a look! I wanted to have the seemless movement to different PCs experience so that's why I can't read events directly from evdev. For emulating it would probably be quite useful! And maybe also in conjunction with the current methods...

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.


Another honest question. Given the availability of way better options like zmq, nng, etc, why do people still reach for raw udp/tcp?

Maybe read this as "I recommend ..."


udp is supported everywhere and also in the rust standard library as well as tokio. zmq and nng from what I can tell are both implemented on top of the transportation layer and use tcp under the hood.

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: