PC Review


Reply
Thread Tools Rate Thread

Compact Framework 2.0 & WM2003

 
 
Stanislav Vlasic
Guest
Posts: n/a
 
      15th Jan 2007
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.
 
Reply With Quote
 
 
 
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Jan 2007
Hi,
"Stanislav Vlasic" <(E-Mail Removed)> wrote in
message news:euqyy3ilxplq.vyfjf22mmesf$.(E-Mail Removed)...
| 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.



--
Ignacio Machin
machin AT laceupsolutions com


 
Reply With Quote
 
Stanislav Vlasic
Guest
Posts: n/a
 
      16th Jan 2007
On Mon, 15 Jan 2007 13:59:57 -0500, Ignacio Machin ( .NET/ C# MVP ) wrote:
>
> 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.
 
Reply With Quote
 
Stanislav Vlasic
Guest
Posts: n/a
 
      16th Jan 2007
On Tue, 16 Jan 2007 07:54:02 +0100, Stanislav Vlasic wrote:

> On Mon, 15 Jan 2007 13:59:57 -0500, Ignacio Machin ( .NET/ C# MVP ) wrote:
>>
>> 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.


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();
 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      16th Jan 2007
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.


--
Ignacio Machin
machin AT laceupsolutions com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any suggestion for directory layout of project support both Full.NET Framework and Compact Framework? ping235 Microsoft C# .NET 0 24th May 2007 03:22 AM
Any suggestion for directory layout of project support both Full.NET Framework and Compact Framework? ping235 Microsoft Dot NET Framework 2 22nd May 2007 02:35 AM
Compact framework throwing formatException but 'normal' framework doesn't John Haxton Microsoft Dot NET Framework 0 17th Apr 2004 08:21 PM
Building a SOAP Message (in Compact Framework) [REPLYING FROM microsoft.public.dotnet.framework] news.microsoft.com Microsoft Dot NET Compact Framework 1 2nd Apr 2004 10:14 PM
Building a SOAP Message (in Compact Framework) [REPLYING FROM microsoft.public.dotnet.framework] news.microsoft.com Microsoft Dot NET Framework 0 16th Mar 2004 04:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:05 AM.