Page 1 of 1

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

Posted: 16 Nov 2010, 06:50
by ericheimburg
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)

Posted: 16 Nov 2010, 06:58
by ThomasLund
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

Posted: 16 Nov 2010, 08:56
by ericheimburg
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.

Posted: 16 Nov 2010, 10:54
by ThomasLund
Never use(d) the debugger - so I am not the best to try to answer that question.

/Thomas

Posted: 30 Nov 2010, 10:35
by Kcm
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 ^.^

Posted: 01 Dec 2010, 19:00
by Democre
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.