Compact Framework 2.0 & WM2003

S

Stanislav Vlasic

Hi.

I'm developing application for compact framework (windows mobile 2003) in
C# and have one problem.

From application, I'm connecting to FTP server and downloading some files.
The problem is that I can connect to ftp only when internet connection is
already established on device. If there is no connection to the internet
(GPRS connection in my case), application raises exception.

I managed to find out if there is active internet connection or not with
InternetCheckConnection function from wininet.dll, but now having trouble
trying to programmicaly establish default internet connection.

Any suggestions?

Thanx.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,
message | Hi.
|
| I'm developing application for compact framework (windows mobile 2003) in
| C# and have one problem.
|
| From application, I'm connecting to FTP server and downloading some files.
| The problem is that I can connect to ftp only when internet connection is
| already established on device. If there is no connection to the internet
| (GPRS connection in my case), application raises exception.

Of course, as there is no connection to the remote host :)

| I managed to find out if there is active internet connection or not with
| InternetCheckConnection function from wininet.dll, but now having trouble
| trying to programmicaly establish default internet connection.
|
| Any suggestions?

Yes, depending of your device and how it's setup you have several options:

1- invoke RAS from your code, it's easy if you have an unmanaged dll that
already encapsulate the RAS methods, otherwise it may be a pain to P/invoke
them.
2- You may try to use WebRequest, IIRC it will try to establish a connection
if none is present. I'm not sure about this as I use the above option.
3- Instruct your user to be sure to be connected before doing the FTP. as
weird as this sound I'm using this option lately (from a iPaq 6315) and they
seems to be happier.
 
S

Stanislav Vlasic

Yes, depending of your device and how it's setup you have several options:

1- invoke RAS from your code, it's easy if you have an unmanaged dll that
already encapsulate the RAS methods, otherwise it may be a pain to P/invoke
them.
2- You may try to use WebRequest, IIRC it will try to establish a connection
if none is present. I'm not sure about this as I use the above option.
3- Instruct your user to be sure to be connected before doing the FTP. as
weird as this sound I'm using this option lately (from a iPaq 6315) and they
seems to be happier.

Ok, thanx, I'll try with options 1 and 2.
 
S

Stanislav Vlasic

Ok, thanx, I'll try with options 1 and 2.

Just a small followup... WebRequest in combination with GetResponse solved
my problem, so the code for connecting looks like this:

WebRequest lwrTemp = WebRequest.Create("http://www.google.com");
WebResponse lwresTemp = lwrTemp.GetResponse();
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


|
| Just a small followup... WebRequest in combination with GetResponse solved
| my problem, so the code for connecting looks like this:
|
| WebRequest lwrTemp = WebRequest.Create("http://www.google.com");
| WebResponse lwresTemp = lwrTemp.GetResponse();

Good to know it solved your problem.
 

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

Top