Unity Web player and BlueBox problem.

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

Moderators: Lapo, Bax

LeMageFou
Posts: 18
Joined: 19 Aug 2011, 15:51

Unity Web player and BlueBox problem.

Postby LeMageFou » 29 Aug 2013, 14:52

Hi.

Currently I'm tried to make BlueBox work but without success.
The SmartFox server listens on port 9933 and Jetty is on port 443. A unity web player client, which is behind a proxy, is trying to connect to the server. We force the client to use BlueBox (by trying a first socket connection on a wrong port) but an error occurs :

Code: Select all

Http error creating http connection: System.Security.SecurityException: 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.Http.SFSWebClient.UploadValuesAsync (System.Uri uri, System.String paramName, System.String encodedData) [0x00000] in <filename unknown>:0
UnityEngine.Debug:Log(Object)
ConnectionManager:OnConnection(BaseEvent) (at Assets/Scripts/Server/ConnectionManager.cs:500)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
ConnectionManager:FixedUpdate() (at Assets/Scripts/Server/ConnectionManager.cs:144)

Since the proxy allows HTTP traffic but doesn't allow a connection using Security.PrefetchSocketPolicy to get the crossdomain policy, how can we make a BlueBox connection with our server?
Do we need a TCP socket connection to get the crossdomain policy in order to make BlueBox work with Unity web player?


Another question : does the SmartFox .NET API use the browser/system proxy settings when trying a socket connection?


Thanks.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity Web player and BlueBox problem.

Postby Lapo » 30 Aug 2013, 10:50

You will need to improve your crossdomain pre-fetch code to support the BlueBox.
I recommend taking a look at this thread:
viewtopic.php?f=20&t=14953

Another question : does the SmartFox .NET API use the browser/system proxy settings when trying a socket connection?

I have never tried in the browser, it all depends on the Web Player itself. If it is aware of those settings it will route the http calls accordingly
Lapo
--
gotoAndPlay()
...addicted to flash games
LeMageFou
Posts: 18
Joined: 19 Aug 2011, 15:51

Re: Unity Web player and BlueBox problem.

Postby LeMageFou » 30 Aug 2013, 11:29

Hi. Thanks for the reply.

If you're talking about the Security.PrefetchSocketPolicy, I already do it on both ports; 9933 (normal) and 443 (BlueBox).
And I have this error log :
SocketPolicyClient1: About to BeginConnect to <server_ip>:9933
SocketPolicyClient1: About to WaitOne
SocketPolicyClient1: WaitOne timed out. Duration: 3002
SocketPolicyClient1: Caught exception: BeginConnect timed out
SocketPolicyClient2: Incoming GetPolicyStreamForIP
SocketPolicyClient2: About to BeginConnect to <server_ip>:443
SocketPolicyClient2: About to WaitOne
SocketPolicyClient2: WaitOne timed out. Duration: 3000
SocketPolicyClient2: Caught exception: BeginConnect timed out
SocketPolicyClient3: Incoming GetPolicyStreamForIP
SocketPolicyClient3: About to BeginConnect to <server_ip>:843
SocketPolicyClient3: About to WaitOne
SocketPolicyClient3: WaitOne timed out. Duration: 3000
SocketPolicyClient3: Caught exception: BeginConnect timed out

[SFS - ERROR] TCPSocketLayer: 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

SocketPolicyClient4: Incoming GetPolicyStreamForIP
SocketPolicyClient4: About to BeginConnect to <server_ip>:843
SocketPolicyClient4: About to WaitOne
SocketPolicyClient4: WaitOne timed out. Duration: 3000
SocketPolicyClient4: Caught exception: BeginConnect timed out

[SFS - ERROR] ## BlueBox Error: Http error creating http connection: System.Security.SecurityException: 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.Http.SFSWebClient.UploadValuesAsync (System.Uri uri, System.String paramName, System.String encodedData) [0x00000] in <filename unknown>:0
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity Web player and BlueBox problem.

Postby Lapo » 31 Aug 2013, 10:25

We'll need some time to investigate this further.
I'll keep you posted.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity Web player and BlueBox problem.

Postby Lapo » 04 Sep 2013, 10:31

UPDATE: I've looked further into this problem and there's definitely some issues in obtaining the cross domain policy.
The essence of the problem is that the crossdomain.xml file cannot be obtained via Security.PrefetchSocketPolicy(...) because it works with raw sockets but not HTTP.

So in the case where the WebPlayer comes from domain-1 and the connection to the BlueBox goes to domain-2 there is indeed a problem. I am surprised this hasn't been noticed before :shock: but that's how it is.

I will follow up with another update as soon as possible.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 46 guests