Author Topic: Read Timeout?  (Read 14218 times)

vanweric

  • Member
  • ***
  • Posts: 24
Read Timeout?
« on: December 13, 2011, 07:31:07 pm »
I'm looking to implement a read timeout on the host for my HID device.  Do you have any of your examples implement this?

I tried wrapping the file handle in a FileStream, but the created stream doesn't support timeouts. 

Thank You
 - Eric

Ray

  • Member
  • ***
  • Posts: 13
Re: Read Timeout?
« Reply #1 on: December 13, 2011, 07:50:19 pm »
Eric,

I would think that you are after the overlapped call to CreateFile, and subsequent ReadFile call and then use the WaitForSingleObject to set a timeout. Jan has an example of this here:

http://www.lvr.com/hidpage.htm#MyExampleCode

Check the Usbhidio_vc6 link down the page.

Ray.
« Last Edit: March 28, 2018, 08:25:16 pm by Jan Axelson »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Read Timeout?
« Reply #2 on: December 13, 2011, 10:27:28 pm »
Yes, and my Filestream example uses a timeout as well. Both are here:

http://www.janaxelson.com/hidpage.htm#MyExampleCode

Jan
« Last Edit: March 28, 2018, 08:25:23 pm by Jan Axelson »