Answered by:
HttpRequestCachePolicy in compact framework?

Question
-
First post
I'm doing a client side application for the new windows mobile 6 using VB.net (and of course the compact framework).
My application maintains it's network connected state information nicely...but I cannot maintain connected speed information accurately.
I am determining connected speed by downloading a 50byte file and then classifying the connection speed as slow, medium or fast. The first download, timing and classification work great...but then the device has the file cached. On subsequent processes of this method the download happens immediately (cached file I'm assuming) which provides false information.
In the normal .NET framework the System.Net.Cache namespace helped by being able to prevent cache access using the HttpRequestCachePolicy class...what can we do in the compact framework to ensure we're not accessing the device's cache???
Thanks!!!
Rob.
(aka: AckThpppttt)
Monday, September 17, 2007 5:49 PM
Answers
-
Hi,
You may either p/invoke IcmpSendEcho2 API to ping the target or use the ready-made Ping class in the OpenNETCF.
Best Regards
Chunsheng TangWednesday, September 19, 2007 3:43 AM -
Hi, Rob
This is the usage of IcmpSendIcho:
http://www.pinvoke.net/default.aspx/icmp/IcmpSendEcho.html
It should save you a lot of work, if not all.
Best Regards
Chunsheng TangSaturday, September 22, 2007 2:07 AM
All replies
-
I don't think there's a caching exist in the NetCF in the WebRequest/WebResponse classes. You can try to increase the size of your test file - 50 bytes is much smaller than the internal buffer.
Tuesday, September 18, 2007 2:48 AM -
But the point of the small file being downloaded is just that, it's small...and it will complete quickly. I have had to revert to this design because the PING class does not exist in the .NET compact framework which would clearly be the best choice to rate your connection speed to your server of choice.
If the compact framework doesn't permit us to disable client side caching when downloading data over HTTP...where would the cached file be located? Perhaps I could clear it manually in code.
Anyone have any other good ideas?
Tuesday, September 18, 2007 1:31 PM -
Hi,
You may either p/invoke IcmpSendEcho2 API to ping the target or use the ready-made Ping class in the OpenNETCF.
Best Regards
Chunsheng TangWednesday, September 19, 2007 3:43 AM -
Thanks very much for your response Chunsheng!
I am having problems getting some of this code implemented...it's not well documented on the internet in regards to integrating into the compact framework. Can you help with this code or maybe toss me some sample code of how to complete a simple ping using the compact framework?
I'll continue to work on this and post some code once I have something that is somewhere close to functional...
Thanks again, much appreciated
Rob.
Friday, September 21, 2007 8:46 PM -
Hi, Rob
This is the usage of IcmpSendIcho:
http://www.pinvoke.net/default.aspx/icmp/IcmpSendEcho.html
It should save you a lot of work, if not all.
Best Regards
Chunsheng TangSaturday, September 22, 2007 2:07 AM