GPRS & HttpWebRequest

D

Duncan Mole

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
 
D

Duncan Mole

Hi all,

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

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