HighTechTalks DotNet Forums  

GPRS & HttpWebRequest

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss GPRS & HttpWebRequest in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Duncan Mole
 
Posts: n/a

Default GPRS & HttpWebRequest - 12-06-2004 , 11:58 AM






Hi,

I am seeing some vey strange behavoir when ussing HttpRequests and a RAS
GPRS connection with the following simple code:

public void DownloadFileText(string filename, string url)

{

/*

if(!ras.Connected)

{

MessageBox.Show("No RAS connection");

return;

}

*/

StartTimer();

//MessageBox.Show(url);

HttpWebRequest request = null;

HttpWebResponse response = null;

try

{

request = (HttpWebRequest)WebRequest.Create(url);

request.Method = "GET";


response = (HttpWebResponse) request.GetResponse();

Stream respStream = response.GetResponseStream();

StreamReader reader = new StreamReader(respStream);

StreamWriter writer = new StreamWriter(filename, false);

string data = reader.ReadLine();

while (data != null)

{

writer.WriteLine(data);

data = reader.ReadLine();

}

reader.Close();

writer.Close();

}

catch (Exception e)

{

MessageBox.Show(e.Message);

}

finally

{

if(response != null)

response.Close();

}

FinishTimer();

}

The strange thing is that if I run this with and Ethernet network connection
I can call this function repeatedly with no problem. I then disconnect my
network adapter and make a RAS dial call, I can see that I have been
connected via an internet APN and have been assigned an IP address. I am
then able to make a single successful call to this methods but the second
and subsequent calls fail with 404 errors!

Has anyone seen anything like this before?

Thanks





Reply With Quote
  #2  
Old   
Duncan Mole
 
Posts: n/a

Default Re: GPRS & HttpWebRequest - 12-07-2004 , 04:07 AM






Hi all,

I think this is some sort of network issue as I have now tested with a
different SIM and its working fine!

"Duncan Mole" <___ (AT) ____ (DOT) com> wrote

Quote:
Hi,

I am seeing some vey strange behavoir when ussing HttpRequests and a RAS
GPRS connection with the following simple code:

public void DownloadFileText(string filename, string url)

{

/*

if(!ras.Connected)

{

MessageBox.Show("No RAS connection");

return;

}

*/

StartTimer();

//MessageBox.Show(url);

HttpWebRequest request = null;

HttpWebResponse response = null;

try

{

request = (HttpWebRequest)WebRequest.Create(url);

request.Method = "GET";


response = (HttpWebResponse) request.GetResponse();

Stream respStream = response.GetResponseStream();

StreamReader reader = new StreamReader(respStream);

StreamWriter writer = new StreamWriter(filename, false);

string data = reader.ReadLine();

while (data != null)

{

writer.WriteLine(data);

data = reader.ReadLine();

}

reader.Close();

writer.Close();

}

catch (Exception e)

{

MessageBox.Show(e.Message);

}

finally

{

if(response != null)

response.Close();

}

FinishTimer();

}

The strange thing is that if I run this with and Ethernet network
connection I can call this function repeatedly with no problem. I then
disconnect my network adapter and make a RAS dial call, I can see that I
have been connected via an internet APN and have been assigned an IP
address. I am then able to make a single successful call to this methods
but the second and subsequent calls fail with 404 errors!

Has anyone seen anything like this before?

Thanks







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.