This content has been marked as final.
Show 2 replies
-
1. Re: XferData(): Losing data?
madhul_36 Apr 13, 2015 4:50 AM (in response to david.white)Hi,
Are you able to replicate the same issue when you use the Cypress Streamer App?
Regards,
- Madhu Sudhan
-
2. Re: XferData(): Losing data?
david.white Apr 13, 2015 8:08 PM (in response to david.white)Largely, yes. Streamer succeeds more often than my code, but it still loses data. I set "Packets to Xer" to 128 (x 512 = 64k) and "Xfers to Queue" to 1, then started it. Then I got the device to send a buffer of data 30 times, one buffer per mouse click. With the timeout at 100, Streamer got all 30. With a timeout of 10 it got 25, and with a timeout of 1 it got 5 (then 8 then 10 in repetitions).The programmer's reference says that XferData() calls Abort() internally "if operation fail". If by "fail" it means times out, then could that be the problem? I'm new to this and don't know exactly what Abort() does, but I'm wondering if data would be lost if it arrives during the small window between the timeout expiring and the Abort() call.Since I posted I tried receiving the data with the set of BeginDataXfer(), WaitForXfer() and FinishDataXfer() instead of XferData(). If WaitForXfer() times out I just call it again. It seems to be working. In early testing it has lost no data even with a timeout of 1. However, I'm not sure if it's right to keep it that simple (meaning, could I be leaving something in a bad state?). Sample code I've seen using those functions also calls Abort() if WaitForXfer() times out and does other things such as check for ERROR_IO_PENDING and the endpoint statuses. The sample code also loses data if I use it as is, which also seems to point the finger at Abort().