IOCTL_FARC_SET_READ_TIMEOUT
Purpose: set timeout value in ms units for subsequent ReadFile
operations on the driver
Parameter:
IN: ULONG ulTimeoutValue
OUT: -
Possible errors (see also Error codes):
E_FARC_INVALID_HANDLE
E_FARC_NO_PARAMETERS
Comment:
Sets the timeout value for ReadFile operations in the driver.
If the driver does not receive an ARCNET data packet after performing a
ReadFile within the timeout value, the ReadFile will return with a
special error code (E_FARC_READ_TIMEOUT). If several ReadFile requests
are started, only the oldest ReadFile will return with errorcode
E_FARC_READ_TIMEOUT.
Then the next ReadFile request is monitored with the timeout restarted.
Note: If not set, ReadFile waits infinetely for the receipt of an ARCNET data packet..
Example:
Note, that the following example is only a fragment. It is recommended,
that the driver is opened in asynchronous mode and a handle to the
driver
is available.
OVERLAPPED overlapped;
DWORD read, err;
BOOL ret;
ULONG ulTimeout;
overlapped.Offset = 0;
overlapped.OffsetHigh = 0;
overlapped.hEvent =
CreateEvent(NULL,TRUE,FALSE,NULL);
...
ulTimeout = 5000; // wait 5
seconds for data
ret = DeviceIoControl(drvhandle,
IOCTL_FARC_SET_READ_TIMEOUT,
&ulTimeout, sizeof(ulTimeout),
NULL, 0,
&read,
&overlapped);
if (!ret)
{
err = GetLastError();
if (err == E_FARC_PENDING)
{
ret
= GetOverlappedResult(drvhandle, &overlapped, &read, TRUE);
if
(!ret)
{
err = GetLastError();
// do errorhandling here
}
}
else
{
//
other error occured, perhaps wrong handle
}
}
// All subsequent ReadFile() requests
from here are monitored with the previously set timeout.
...