Hi,

I have created an I/O target from a socket but when I send an I/O request to
it, it won't timeout.

The socket was created with WSASocket passing WSA_FLAG_OVERLAPPED and I used
setsockopt() to set read/write timeout as below. After setting these options
the I/O target is created using
IWDFFileHandleTargetFactory::CreateFileHandleTarget.

When I send down the request I specify a timeout of 10 seconds, but it won't
work.

Socket creation:
socket =
WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,0,WSA_FLAG_OVERLAPPED);

Socket configuration:
int iOptVal = 3000;
res = setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, (char*)&iOptVal,
sizeof(iOptVal));
res = setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (char*)&iOptVal,
sizeof(iOptVal));

I/O Target creation:
IWDFFileHandleTargetFactory *fileHandleTargetFactory = NULL;
IWDFIoTarget *target = NULL;
hr = fxDevice->QueryInterface(IID_PPV_ARGS(&fileHandleTargetFactory));
hr = fileHandleTargetFactory->CreateFileHandleTarget(socket, &target);
fileHandleTargetFactory->Release();

Request forwarding:
request->Send(target,WDF_REQUEST_SEND_OPTION_TIMEOUT,-100000000);


Has anyone had this problem? How can I set a timeout for a request sent to
an I/O target created from a socket handle?

Thanks in advance.

Re: I/O target from socket doesn't timeout by Abhishek

Abhishek
Tue Jul 08 16:44:59 CDT 2008

Did you set a completion callback for this request? If so, did the
completion routine ever get invoked? If so, what was the request completion
status you got in your completion routine?

"Figueredo" <Figueredo@discussions.microsoft.com> wrote in message
news:F92E7CEB-5AB0-4802-902C-62D1DCDF2184@microsoft.com...
> Hi,
>
> I have created an I/O target from a socket but when I send an I/O request
> to
> it, it won't timeout.
>
> The socket was created with WSASocket passing WSA_FLAG_OVERLAPPED and I
> used
> setsockopt() to set read/write timeout as below. After setting these
> options
> the I/O target is created using
> IWDFFileHandleTargetFactory::CreateFileHandleTarget.
>
> When I send down the request I specify a timeout of 10 seconds, but it
> won't
> work.
>
> Socket creation:
> socket =
> WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,0,WSA_FLAG_OVERLAPPED);
>
> Socket configuration:
> int iOptVal = 3000;
> res = setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, (char*)&iOptVal,
> sizeof(iOptVal));
> res = setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (char*)&iOptVal,
> sizeof(iOptVal));
>
> I/O Target creation:
> IWDFFileHandleTargetFactory *fileHandleTargetFactory = NULL;
> IWDFIoTarget *target = NULL;
> hr = fxDevice->QueryInterface(IID_PPV_ARGS(&fileHandleTargetFactory));
> hr = fileHandleTargetFactory->CreateFileHandleTarget(socket, &target);
> fileHandleTargetFactory->Release();
>
> Request forwarding:
> request->Send(target,WDF_REQUEST_SEND_OPTION_TIMEOUT,-100000000);
>
>
> Has anyone had this problem? How can I set a timeout for a request sent to
> an I/O target created from a socket handle?
>
> Thanks in advance.