S
Stelrad Doulton
Hi,
I am having real trouble using the Vodaphone "internet" APN. I am doing a
very simple HttpWebRequest to retrieve a 7 k text file. I am careful to
close the response stream so that subsequent requests will be serviced....
only they are not. Only the first request is successful, after this I just
get 404 or timeout errors. The same code on a the T-Mobile
general.t-mobile.uk APN does not suffer with this issue!!
Hanging up and redialling does not help, only restarting the app will solve
the problem. I don't understand this behaviour!! Has anyone seen anything
similar? Or has a suggestion?
public void DownloadFileText(string filename, string url)
{
if(!ras.Connected)
{
MessageBox.Show("No RAS connection");
return;
}
StartTimer();
HttpWebRequest request = null;
HttpWebResponse response = null;
try
{
request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
response = (HttpWebResponse) request.GetResponse();
MessageBox.Show(response.StatusCode.ToString());
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)
{
MessageBox.Show(response.StatusCode.ToString());
response.Close();
}
request = null;
response = null;
}
FinishTimer();
}
Thank you all.
I am having real trouble using the Vodaphone "internet" APN. I am doing a
very simple HttpWebRequest to retrieve a 7 k text file. I am careful to
close the response stream so that subsequent requests will be serviced....
only they are not. Only the first request is successful, after this I just
get 404 or timeout errors. The same code on a the T-Mobile
general.t-mobile.uk APN does not suffer with this issue!!
Hanging up and redialling does not help, only restarting the app will solve
the problem. I don't understand this behaviour!! Has anyone seen anything
similar? Or has a suggestion?
public void DownloadFileText(string filename, string url)
{
if(!ras.Connected)
{
MessageBox.Show("No RAS connection");
return;
}
StartTimer();
HttpWebRequest request = null;
HttpWebResponse response = null;
try
{
request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
response = (HttpWebResponse) request.GetResponse();
MessageBox.Show(response.StatusCode.ToString());
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)
{
MessageBox.Show(response.StatusCode.ToString());
response.Close();
}
request = null;
response = null;
}
FinishTimer();
}
Thank you all.