Problem with 1.2.4

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 04 May 2010, 20:47

Hey,

Your code is totally correct. But it also suffers from the same Mono bug if you try to run that in the API. At least it throws the exact same error here when I paste that in after closing tab and trying to connect again.

(Also beware that it might look as if it all works if you run bluebox - the bluebox lookup seems to work correctly with hostname lookup)

Thread about the bug from the Unity forums:
http://forum.unity3d.com/viewtopic.php?t=13483

As you can see I was fooled by some small tests I made into thinking it was fixed - and thus put it into the API 1.2.4 :-(

/Thomas
Molix
Posts: 40
Joined: 01 Apr 2009, 19:34
Location: Toronto, ON, Canada

Postby Molix » 04 May 2010, 20:54

In the short-term I'm fine with IPs (it has been so long now we're used to it -- I didn't even remember that GetHostEntry() was a problem! :) The main thing was preventing the lockout on those browsers.

Thanks!
Thelo
Posts: 11
Joined: 02 Mar 2010, 07:59

Postby Thelo » 11 May 2010, 03:31

I have the same problem, and applying the fix from the code snippet to force SFS to NOT use DNS resolution works... kind of. But a different error right afterwards still prevents Mac Firefox from connecting properly.

I added a few debug logs to the SFS CSharp API to see what was going on, but I'm still puzzled - it seems to be another problem specific to Mac Mono. Basically, it looks like the function GetString(XmlNode, string) from XmlUtil.cs, when called from XmlReceived (SmartFoxClient.cs), throws an exception it's not supposed to throw. I added a "catch (Exception e)" in XmlReceived to see what was going on. Here's what I get from DebugMessage on the Mac Firefox webplayer, with lines starting with "###" being log additions of my own:

Any idea on how to prevent this?

Code: Select all


> Trying to connect
> [Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='154' /></body></msg>

> ### Read 92 bytes
> ### messages.Count is 2
> [ RECEIVED ]: <cross-domain-policy><allow-access-from domain='*' to-ports='9339' /></cross-domain-policy>, (len: 91)
> XmlReceived: <cross-domain-policy><allow-access-from domain='*' to-ports='9339' /></cross-domain-policy>
> ### XML Handler exception System.TypeInitializationException: An exception was thrown by the type initializer for System.Console ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.ConsoleDriver ---> System.IO.IOException: Win32 IO returned 50. Path: /etc/terminfo
  at System.IO.Directory.Exists (System.String path) [0x00000]
  at System.TermInfoDriver.SearchTerminfo (System.String term) [0x00000]
  at System.TermInfoDriver..ctor (System.String term) [0x00000]
  at System.ConsoleDriver..cctor () [0x00000] --- End of inner exception stack trace ---

  at <0x00000> <unknown method>
  at System.Console..cctor () [0x00000] --- End of inner exception stack trace ---

  at <0x00000> <unknown method>
  at Mono.Xml.XPath.XPathParser..ctor (IStaticXsltContext context) [0x00000]
  at System.Xml.XPath.XPathExpression.Compile (System.String xpath, IXmlNamespaceResolver nsmgr, IStaticXsltContext ctx) [0x00000]
  at System.Xml.XPath.XPathExpression.Compile (System.String xpath) [0x00000]
  at System.Xml.XPath.XPathNavigator.Compile (System.String xpath) [0x00000]
  at System.Xml.XmlNode.SelectSingleNode (System.String xpath, System.Xml.XmlNamespaceManager nsmgr) [0x00000]
  at System.Xml.XmlNode.SelectSingleNode (System.String xpath) [0x00000]
  at SmartFoxClientAPI.Util.XmlUtil.GetString (System.Xml.XmlNode node, System.String path) [0x00000]
  at SmartFoxClientAPI.SmartFoxClient.XmlReceived (System.String msg) [0x00000]
> ### Read 54 bytes
> ### messages.Count is 2
> [ RECEIVED ]: <msg t='sys'><body action='apiOK' r='0'></body></msg>, (len: 53)
> XmlReceived: <msg t='sys'><body action='apiOK' r='0'></body></msg>
> ### XML Handler exception System.TypeInitializationException: An exception was thrown by the type initializer for System.Console ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.ConsoleDriver ---> System.IO.IOException: Win32 IO returned 50. Path: /etc/terminfo
  at System.IO.Directory.Exists (System.String path) [0x00000]
  at System.TermInfoDriver.SearchTerminfo (System.String term) [0x00000]
  at System.TermInfoDriver..ctor (System.String term) [0x00000]
  at System.ConsoleDriver..cctor () [0x00000] --- End of inner exception stack trace ---

  at <0x00000> <unknown method>
  at System.Console..cctor () [0x00000] --- End of inner exception stack trace ---

  at <0x00000> <unknown method>
  at Mono.Xml.XPath.XPathParser..ctor (IStaticXsltContext context) [0x00000]
  at System.Xml.XPath.XPathExpression.Compile (System.String xpath, IXmlNamespaceResolver nsmgr, IStaticXsltContext ctx) [0x00000]
  at System.Xml.XPath.XPathExpression.Compile (System.String xpath) [0x00000]
  at System.Xml.XPath.XPathNavigator.Compile (System.String xpath) [0x00000]
  at System.Xml.XmlNode.SelectSingleNode (System.String xpath, System.Xml.XmlNamespaceManager nsmgr) [0x00000]
  at System.Xml.XmlNode.SelectSingleNode (System.String xpath) [0x00000]
  at SmartFoxClientAPI.Util.XmlUtil.GetString (System.Xml.XmlNode node, System.String path) [0x00000]
  at SmartFoxClientAPI.SmartFoxClient.XmlReceived (System.String msg) [0x00000]
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 11 May 2010, 06:19

I tested the fix posted in Firefox on the Mac - and it works here. So I dont know what problem you run into.

Can you post some client code (or PM it to me)

/Thomas
Thelo
Posts: 11
Joined: 02 Mar 2010, 07:59

Postby Thelo » 12 May 2010, 04:54

PM sent.

***

Edit: Actually, here's a way simpler test case I just found to replicate that problem. Tag this in SmartFoxClient.cs:

Code: Select all

public static string DEBUGTEST(string msg)
{
   string handlerId;
   try
   {
      XmlDocument xmlData = new XmlDocument();
      xmlData.LoadXml(msg);
      handlerId = XmlUtil.GetString(xmlData, "/msg/@t");
   }
   catch (Exception e)
   {
      return e.ToString();
   }
   return handlerId;
}


Then call it somewhere like this in Unity:

Code: Select all


    private string debugLog = "";
    void OnGUI()
    {
        if (GUI.Button(new Rect(120, 230, 100, 25), "DEBUGTEST"))
        {
            string s = SmartFoxClient.DEBUGTEST("<msg t='sys'><body action='apiOK' r='0'></body></msg>");
         debugLog += "\n>> " + s;
        }

        GUI.TextArea(new Rect(10, 260, Screen.width - 20, Screen.height - 280), debugLog);
    }



In most cases, when you click DEBUGTEST it'll just print out "sys", which is correct. But in Mac Firefox webplayer it'll print out this:

Code: Select all

>> System.TypeInitializationException: An exception was thrown by the type initializer for System.Console ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.ConsoleDriver ---> System.IO.IOException: Win32 IO returned 50. Path: /etc/terminfo
  at System.IO.Directory.Exists (System.String path) [0x00000]
  at System.TermInfoDriver.SearchTerminfo (System.String term) [0x00000]
  at System.TermInfoDriver..ctor (System.String term) [0x00000]
  at System.ConsoleDriver..cctor () [0x00000] --- End of inner exception stack trace ---

  at <0x00000> <unknown method>
  at System.Console..cctor () [0x00000] --- End of inner exception stack trace ---

  at <0x00000> <unknown method>
  at Mono.Xml.XPath.XPathParser..ctor (IStaticXsltContext context) [0x00000]
  at System.Xml.XPath.XPathExpression.Compile (System.String xpath, IXmlNamespaceResolver nsmgr, IStaticXsltContext ctx) [0x00000]
  at System.Xml.XPath.XPathExpression.Compile (System.String xpath) [0x00000]
  at System.Xml.XPath.XPathNavigator.Compile (System.String xpath) [0x00000]
  at System.Xml.XmlNode.SelectSingleNode (System.String xpath, System.Xml.XmlNamespaceManager nsmgr) [0x00000]
  at System.Xml.XmlNode.SelectSingleNode (System.String xpath) [0x00000]
  at SmartFoxClientAPI.Util.XmlUtil.GetString (System.Xml.XmlNode node, System.String path) [0x00000]
  at SmartFoxClientAPI.SmartFoxClient.DEBUGTEST (System.String msg) [0x00000]

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 3 guests