I am using dio_read
in PHP to capture input from a serial device (specifically the USB IR Toy v2 from Dangerous Prototypes).
Sometimes the input from the device is slow (10+ seconds). I'd like to timeout the dio_read
, but not sure how.
If someone reading this post knows how, could you help point me in the right direction? thanks.
dio_read on Windows (other platforms unknown) will not timeout if there is no data to read. There is no way to specify a timeout or do a non-blocking read on Windows. http://php.net/dio_read
You can use dio_fctnl() to set the file descriptors flags to O_NONBLOCK or O_ASYNC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With