Saturday, March 6, 2010

Mastering Internet Programming on Mobile Devices: First Steps

So, you need to develop an application that will be able to send and receive some data over the Internet or an intranet from/to remote Web servers. This article set will help you figure out how to do it using WinInet for many common cases. This article will review the initial steps. Let's say a couple of words regarding which language to use or mainly which environment to use: CF.NET or native C/C++ code. With all the enhancements that CF.NET SP2 has, it still experiences particular troubles with communications; for example, communications through proxy servers requiring NTLM authentication. Native code provides many more opportunities on this topic. Thus, when making your final decision, keep all this in mind. In this article, we will use both C++ and C# for code snippets.
Managing URLs
Prior to establishing any connection, your application should have a valid URL to connect to. WinInet provides a wide set of functions to deal with. First, there are a couple of calls to verify whether there is an opportunity to start communications:DWORD InternetAttemptConnect(DWORD dwReserved);
BOOL InternetCheckConnection(LPCSTR lpszUrl,DWORD dwFlags,
DWORD dwReserved);
You can use them to be sure the device is connected to the network and the request may be executed.
Post a comment
Email Article
Print Article
Share Articles
Digg
del.icio.us
Slashdot
DZone
Reddit
StumbleUpon
Facebook
FriendFeed
Furl
Newsvine
Google
LinkedIn
MySpace
Technorati
Twitter
Windows Live
YahooBuzz
initArticleMenu(document.getElementById("toolBoxShareMenu"));

Other useful API calls are:
InternetGetConnectedState—retrieves the connected state of the local system
InternetGetConnectedStateEx—retrieves the connected state of the specified Internet connection
They show the existing capabilities on a particular system. Via these functions, you may deetct whether the system uses a proxy server to establish connection.
The next group of functions helps you deal with URLs. They are listed below:
InternetCrackUrl
InternetCreateUrl
InternetCombineUrl
InternetCanonicalizeUrl

No comments:

Post a Comment