Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

BeginRead does not abort IO after IOTimout has expired.

After starting an asynchronous IO operation, like BeginRead, the delegate does not return (or does not abort) after the IOTimeout period has elapsed.  I made an attempt using a System.Timers.Timer object and set its Interval through a Select...Case method based on the current IOTimeout setting.  After the timer elapsed, if the Async IO was completed then I called Device.AbortAsyncronousIO.  That cause large hang times in my app.
 
Is there a way to be notified of Async IO timeouts or is there a way to set a timeout period for Async IO operations?
 
0 Kudos
Message 1 of 3
(3,317 Views)
If you haven't already seen it, the example in C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\GPIB\SimpleAsynchronousReadWrite\CS
 would probably be helpful to you.  It shows how to use these Asynchronous calls and callbacks and successfully returns a timeout condition for me.
 
Scott B.
GPIB Software
0 Kudos
Message 2 of 3
(3,297 Views)

Most likely, the delegate never returns because an exeption was thrown (within a Try...Catch block or not) inside of the method called by the BeginRead method.  Delegates ALWAYS terminate when an exception is thrown, even if you catch the exception inside of a Try...Catch block.  That is what most of the hang-ups I experience are caused by.  Using a thread will allow you to catch exceptions and get a response if coded correctly.

Hope this helps

 

0 Kudos
Message 3 of 3
(3,188 Views)