serial-port
serial-port copied to clipboard
"serialstream << " timeout
Hello!
This looks like a great starting point for my needs, any chance you can add a timeout on the write operation as well? If the (e.g. USB) device goes away or locks up for some reason, I need a timeout and abort the port, go look for it again (using e.g. udev) and restart the process if/when it comes back online. Also, a flush of the input could be handy if there is some old garbage hanging around. This would be typical for say, a modem.
I could technically add this myself using your excellent code as a starting point, but I find that the long term maintenance is better if not forking...
BR,
Stefan
Are you sure write could block indefinitely? If the USB device goes away write I believe write will return an exception. Can you provide a quick example code to reproduce this condition?