opens and closes a connection (GPRS)

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
 
P

Peter Foot [MVP]

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
 
S

Saep

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
 
P

Peter Foot [MVP]

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
 
S

Saep

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

GPRS Connection 4
GPRS 2
Simultaneously connect to Active Sync and GPRS 1
Open GPRS Connection 3
GPRS connection W CE 5.0 3
fully disconnecting a GPRS connection 3
GPRS Connection 3
Gprs reconnection 1

Top