opens and closes a connection (GPRS)

  • Thread starter Thread starter Saep
  • Start date Start date
S

Saep

Hi,
I developed an application with Compact Framwork in VB.net
(PocketPC2003).
My application send and receive files with FTP and then I created a
connection (GPRS).
I would my application opens and closes this connection...
Is it possible?

Thanks
Marco
 
On Windows Mobile devices it's generally recommended that rather than
directly try to establish a connection, you go through the Connection
Manager API which will pick the appropriate connection for you based on the
target network you wish to access. OpenNETCF have a .NETCF wrapper around
Connection Manager in the SDF - www.opennetcf.org/sdf/
Its simple to use e.g.

Dim cm As New OpenNETCF.Net.ConnectionManager()
cm.Connect()

Will connect you to the internet. See the documentation for numerous other
overrides.

Peter
 
Hi Peter,
Thanks for your reply, but I have a problem.
I download and install OpenNETCF.
I use your code:
Dim cm As New OpenNETCF.Net.ConnectionManager()
cm.Connect()
But when I execute "cm.Connect" then Gprs connection is always closed (I
tested the property "cm.State")... Why??

Thanks
Marco
 
Connect without arguments (as I said there are a few overloads to this
method) starts an asynchronous connection, so you should see some activity
in the icon tray as the connection begins however it will take a few seconds
for the connection to be established. You can either poll the State in a
loop to determine when the connection is available, or use the override for
the method which blocks until the connection is established
cm.Connect(ConnectionMode.Synchronous)

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net |
http://www.opennetcf.org
 
Hi Peter,
my code is:

dim cm As New OpenNETCF.Net.ConnectionManager
cm.Connect()
While cm.State <> OpenNETCF.Net.ConnectionManagerState.Connected
MsgBox("Attendi")
End While
And I configured a GPRS connection on my PocketPC.
Also then several minutes cm.State is always equal to "disconnected".
In help I read cm.connect using the system default destination. How can I
know the "system default destination"?
Also I read I can specify a destination, but I can't understand how...

I hope you can help me...

Thanks
Marco
 
Back
Top