From: Krish on
Hi,

I need to fetch some data from the server, so created a Synchronous
Wininet code using Win32 / Windows Mobile 6.5

I have created a worker thread to call the Wininet api's.

I am having couple of issues when I try to cancel my network
transaction.

1. When I cancel the network transaction on status
INTERNET_STATUS_RESOLVING_NAME, subsequent calls to InternetOpenUrl
after the cancel results in 12007. I need to exit the application and
relaunch it to get rid of this error.

2. Start a network transaction -> Make a Incoming call -> Main Thread
cancels the Worker Thread -> The very next call to InternetOpenUrl
results in 12031 or 12002, after that it works fine.

Code Flow:

Main Thread calls worker thread to start the network Transaction
{
Event A
Network Thread
}

Network Thread call the wininet apis
{
InternetOpen
InternetOpenUrl
InternetReadFile
}

On Suspend (Phone Incoming Call / Minimizing the application)
{
Main Thread Cancels the Network Thread
WaitForSingleObject(Event A, 5000) // If I use Infinite instead of
5000 all issues are resolved but my main thread is blocked which
created lot of other issues like screen is not getting painted
on Wait_Timeout I am closing the Session and request handle and the
network thread handle.
}

Can someone please point me where I am going wrong?

Thanks,
Krish
 | 
Pages: 1
Prev: debug VB smartdeviceproject
Next: user control