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
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