Can't run in debugger... crossdomain policy error

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

ericheimburg
Posts: 26
Joined: 18 Mar 2010, 07:25

Can't run in debugger... crossdomain policy error

Postby ericheimburg » 16 Nov 2010, 06:50

When I try to run my app through the debugger (in Unity 3), I get connection failure messages about missing crossdomain.xml.

But there IS a crossdomain.xml file. When I run the app in a browser, it works fine. And it works fine normally in the IDE.

I have the field under Unity->Project Settings->Editor "WWW Security Emulation settings" set to http://localhost/. I can confirm that http://localhost/crossdomain.xml exists.

Can you instruct me how to get the system to connect under the debugger?

Here's the exception:

Code: Select all

On Connection callback got: False (error : <General exception on connection: Unable to connect, as no valid crossdomain policy was found   at System.Net.Sockets.Socket.Connect_internal (IntPtr sock, System.Net.SocketAddress sa, System.Int32& error, Boolean requireSocketPolicyFile) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0
  at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0 >)
UnityEngine.Debug:Log(Object)
ESMainState:OnConnect(BaseEvent) (at Assets/Scripts/ElectroServer/ESMainState.cs:349)
Sfs2X.Core.EventListenerDelegate:invoke_void__this___BaseEvent(BaseEvent)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ESMainState:FixedUpdate() (at Assets/Scripts/ElectroServer/ESMainState.cs:312)
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 16 Nov 2010, 06:58

Quick answer is - I dont know.

The cross domain policy stuff is all Unity, and I do not know how it works when run in debug mode. Sorry.

/Thomas
ericheimburg
Posts: 26
Joined: 18 Mar 2010, 07:25

Postby ericheimburg » 16 Nov 2010, 08:56

Are you able to run SFS2X clients in the debugger yourself? Is anybody?

I don't know if this is something I can fix by randomly fiddling with my code or not.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 16 Nov 2010, 10:54

Never use(d) the debugger - so I am not the best to try to answer that question.

/Thomas
Kcm
Posts: 3
Joined: 17 Feb 2009, 13:50

Postby Kcm » 30 Nov 2010, 10:35

Try to change platfrom :

in: File/Build Settings/
Click on "PC and Mac standalone"
"Switch platform" button

It correct this problem for me...

I don't know why ^.^
Democre
Posts: 77
Joined: 16 Sep 2010, 17:58

Postby Democre » 01 Dec 2010, 19:00

I added this bit of code before any connection attempt:
(this is in unityscript not .Net, but should be available in .Net as well)

Code: Select all

   if(Application.isWebPlayer || Application.isEditor){
      Security.PrefetchSocketPolicy(sfs2xIP, sfs2xPort);
   }


This works for me running in the editor whether I have the platform as web player or standalone. It also lets my standalone builds run without editing code as well.

Return to “SFS2X C# API”

Who is online

Users browsing this forum: Thomasea and 26 guests