[MonoTouch] ConnectFailure error causes app to cease connecting externally
Rolf Bjarne Kvinge
rolf at xamarin.com
Mon Oct 24 05:51:51 EDT 2011
Hi,
Yeah, my guess would be that you're missing a Close/Dispose somewhere
(but I couldn't find anything missing in the case you showed). I
wouldn't look at the web services first, it's more likely a problem
with the code where you're using sockets and/or http requests
yourself.
Rolf
On Mon, Oct 24, 2011 at 4:49 AM, bamagrad03 <daniel at ilogicweb.net> wrote:
> I've got an app that does a number of externally focused things: twitter via
> oAuth, connecting to my web server services, etc. And everything works
> great, but after about 3-4 minutes of heavy use, the app starts throwing:
>
> Error: ConnectFailure (System call failed)
>
> More specifically:
>
> at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult
> asyncResult) [0x00000] in <filename unknown>:0
> at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename
> unknown>:0
> at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
> (System.String method_name, System.Object[] parameters) [0x00000] in
> <filename unknown>:0
>
> Now, I can trap for this. But the bigger issue is, once I get this error,
> the app NEVER recovers. It won't connect to my RSS feeds, Twitter oAuth, or
> any of my webservices. I continue to get the same connectfailure error until
> I restart the app.
>
> Could this be a case of me not disposing manually of some resource that I
> should be? Here's some code from my webservice data pull, but keep in mind,
> this is only one of many ways I connect.
>
> List<BBStandings> rank = new List<BBStandings>();
> try{
> var service = new ServiceName.Service();
>
> XmlDocument xmlDoc = new XmlDocument();
> xmlDoc.LoadXml(service.GetStandings());
>
> string s = xmlDoc.InnerXml;
> -- bunch of variables declared
> int iCount = 1;
>
> if (s != "<NewDataSet />")
> {
> System.Xml.XmlTextReader xml = new System.Xml.XmlTextReader(new
> System.IO.StringReader(s));
> int iXML = 0;
>
> while (xml.Read())
> {
> switch (xml.NodeType)
> {
> case XmlNodeType.EndElement:
> iCount = 1;
> sElement = "";
> sText = "";
> break;
> case XmlNodeType.Element:
> sElement = xml.Name;
> iCount = 2;
> break;
> case XmlNodeType.Text:
> //sElement = xml.Name;
> sText = xml.Value;
> iCount = 3;
> break;
> }
> if (iCount == 3)
> {
> switch (sElement)
> {
> case "TeamID":
> sTeamID = sText;
> iCount = 1;
> break;
> case "TeamName":
> sTeamName = sText;
> iCount = 1;
> break;
> case "ConferenceRecord":
> sConferenceRecord = sText;
> iCount = 1;
> break;
> case "Record":
> sRecord = sText;
> BBStandings r = new BBStandings();
>
> r.TeamID = Convert.ToInt32(sTeamID);
> r.TeamName = sTeamName;
>
> r.ConferenceRecord = sConferenceRecord;
>
> r.Record = sRecord;
>
> rank.Insert(iXML, r);
>
> iXML += 1;
> sTeamID = "";
> sConferenceRecord = "";
>
> sTeamName = "";
> sRecord = "";
> sText = "";
> sElement = "";
> break;
> }
> }
> }
> }
> }
> catch (Exception ex)
> {
> string s=ex.Message;
> }
> return rank;
>
> I'm running MD 2.6.0.1
> MonoFramework 2.10.5
> MT 4.2.2
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/ConnectFailure-error-causes-app-to-cease-connecting-externally-tp3931899p3931899.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
More information about the MonoTouch
mailing list