for (int i = 0; i < endurance / 10; i++) {
log.Info("mining now : " + endurance / 10 + " - " + i);
HttpWebRequest mineRequest = WebRequestUtil.CreateHttpWebRequest(Properties.Settings.Default.PAGE_URL + Properties.Settings.Default.MINING_URL);
string source = SourceParser.GetSource(mineRequest); // GETTING TIMED OUT HERE
string variable = GetHiddenVariableNumber(source);
Mine(variable);
}
My GetSource method:
public static string GetSource(WebRequest request) {
using (WebResponse response = request.GetResponse()) {
using (Stream stream = response.GetResponseStream()) {
using (StreamReader reader = new StreamReader(stream)) {
return reader.ReadToEnd();
}
}
}
}
LOG:
2013-03-03 02:10:56,101 [13] INFO Bot.Game.Mining mining now : 10 - 0
2013-03-03 02:10:57,053 [13] INFO Bot.Game.Mining mining now : 10 - 1
2013-03-03 02:10:58,155 [13] INFO Bot.Game.Mining mining now : 10 - 2 // ends here
Any suggestions? I read alot about it and usual problem was that not of disposing of Stream
or WebResponse
object, but I am doing that.