views:

63

answers:

3

Hi, I am writing an application in which I need to make a GPRS connection.

Can someone please help me how I can setup this connection using C#.

thanks

EDIT I will need to connect a GPRS connection because I need to call a webservice.

A: 

This page might help...

http://msdn.microsoft.com/en-us/library/bb840031.aspx

Dom
A: 

Is it really important to explicitly create that connection? If you initiate any outgoing (eg. not localhost) connection (like a HttpWebRequest), the OS will automatically connect to the Internet using the preferred connection, which can be GPRS.

dnet
no, if the connection is created automatically it will be fine. so i need to define a default Access point? Is this possible when calling a webservice?
mouthpiec
You need to set the exact parameters of the connection, which is pretty much provider-dependent, so it's better to ask your mobile service provider. One thing is for sure: you have to set the phone number to *99#, which will be recognized by the modem in the device.Calling a webservice does not make any difference, it'll become a TCP connection on lower level (behind the curtains) so the first time you invoke any webservice method, the connection will be established, and the execution will be blocked until it's up and running.
dnet
i have all the parameters required, but i cannot find any sample code .... do you have an example?
mouthpiec
A: 

To make a GPRS connect using a dial up connection subsystem from .NET CF on PocketPC, you can use Connection Manager functions such as ConnMgrEnumDestinations, ConnMgrEstablishConnection and ConnMgrReleaseConnection. Check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/APISP/html/sp_cnmn_connection_manager.asp for details. There are no classes available for this in .NET CF, but it can be done quite easily using P/Invoke if you have some experience with this. The following blog post covers this in detail and also contains some C# code: http://blogs.msdn.com/anthonywong/archive/2006/03/13/550686.aspx.

Another solution is using the Smart Device Framework by OpenNETCF.org that contains a wrapper class for the Connection Manager: http://www.opennetcf.org/downloads/bin/SmartDeviceFramework14.zip It is free for any commercial or noncommercial purpose up to the version 1.4. It also includes the source code, so you might either use it as is or as a reference for your own implementation if you prefer.

(solution taken from our website at http://forum.rebex.net/questions/503/how-to-establish-a-gprs-connection-for-ftp-use-on-net-cf)

Martin Vobr