views:

3297

answers:

1

I am trying to convert a windows forms application to a windows mobile application (windows mobile 6 professional). It needs to get an XML document from a web server. It works fine if the device already has an open network connection, say if you open IE before running the app. But it hangs if there is not an open connection.

I have figured out a couple of different ways to open a connection if the connection did not already exist, but each hangs the app if the connection is already open.

What is the correct way to test for an open connection, and if one does not already exist, open one?

Thanks

+4  A: 

You should use the ConnectionManager APIs to request that the device make a connection. For WinMo 5.0 and later. Jim Wilson has an article on managed use of the API here. You can also use a CSP as well. Of course OpenNETCF's SDF has a set of ConnectionManager classes as well.

ctacke
Also, found a tutorial video of the same info at http://msdn.microsoft.com/en-us/netframework/bb495180.aspx, based on your links :)
shimonyk