Problems with SmartFox in Unity and proxy

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

Moderators: Lapo, Bax

jerome
Posts: 3
Joined: 18 Feb 2009, 12:31

Problems with SmartFox in Unity and proxy

Postby jerome » 18 Feb 2009, 13:42

Hello

We can't connect to our sfs server with a unity application behind some proxy server, even with bluebox setup.

Is the new API allow connection through a proxy ?

After a lot of test with our application we finaly try to analize the "SmartFoxLobby" sample shipped with the C Sharp API with a network analizer and we discover that the conections packets is send directly to the SFS server without using the proxy server at all.

There is 3 successive attempt on port 443 (sfs socket port), then 3 attempt on port 80 (blue box port). All directly send to server and not to proxy. I can post the analize report if it's can help.

Are we doing something wrong ? Or is it a known issue with the CSharp API ?

Thank you a lot

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

Postby ThomasLund » 18 Feb 2009, 13:57

Hi Jerome

The API takes the IP number you give it and uses that for creating a socket connection to that IP.

I have not tested it through a proxy, but wouldnt you have to specify the proxy IP address as the end point seen from the SFS client!?!?!?

If anything else is needed codewise for the API to connect through proxies (like support for some proxy protocol), then that is not coded.

Forgive me if thats what you do already. Need more information :-)

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

Postby ThomasLund » 18 Feb 2009, 14:12

Ahhh - a little googling later + talking to the local expert.

No - the API does not support proxies like http, https or SOCKS5

I've added that to the todo/idea list for the next version.

There seem to be quite a few wrapper libraries on the net, so it might be pretty simple to add it. If anyone really really needs it right now, then you are very welcome to add it yourself (API sources are included in the download) and send me the changes. I'll get that into the current development build.

Best
Thomas
jerome
Posts: 3
Joined: 18 Feb 2009, 12:31

Postby jerome » 18 Feb 2009, 14:17

hi

It's not the sfs server who is behind a proxy it is the client. And I can't specify the proxy IP address as the end point for the client because the client would never reach the sfs server. (or i miss something)

And it's it's not possible to configure proxy to redirect to our sfs server because we cant modify client configuration ...

With flash samples of SFS there is no problem, connection use blue box automaticly in exactly the same configuration.

It is a lack of the CSharp APi and if yes do you plan to implement this ?

Best
Jerome
jerome
Posts: 3
Joined: 18 Feb 2009, 12:31

Postby jerome » 18 Feb 2009, 14:37

Hum ok :p
I'am not sure to have time and knowledge to do that but do you know the name of wrapper for this ? I can take a quick look to know if it's possible or not. And do you know the entry point where I can go to add this feature in the API ?
Jerome
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 18 Feb 2009, 16:05

Honestly - I have no idea what to recommend. Its pretty unknown territory for me, so I have not looked at anything at all. And without having tried this (or even a testbed to test it with) I dont know if wrapper X is better than Y.

If others have a wrapper they can recommend then chime in - else its up to google and try something until it works.

The places to insert it into the API would be 2 places.

In the smartfoxclient.cs there is the ConnectThread() method
In Http/HttpConnection.cs you have thr HttpSendViaSockets() method

Those are the 2 places where sockets are connecting, and thats where you would have to implement any connection proxy protocol wrapper.

Let me know what you find.

/Thomas
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 Feb 2009, 10:07

Hi,
I am a little confused...
After a lot of test with our application we finaly try to analize the "SmartFoxLobby" sample shipped with the C Sharp API with a network analizer and we discover that the conections packets is send directly to the SFS server without using the proxy server at all.


Which proxy server?

If I understand correctly you a Unity client connecting to SmartFoxServer with a proxy in between. Is this correct?
If this is the case and the socket connection goes directly to the server it means that your proxy is not blocking socket connections, which is good, at least from the multiplayer experience perspective :)

In case the the socket connection is blocked, the API would try an HTTP tunneled connection trying to "fool" the proxy. Depending on the type of proxy and the amount of checks it performs on the HTTP requests, it could be successful or not.
Lapo
--
gotoAndPlay()
...addicted to flash games
gildas
Posts: 2
Joined: 24 Mar 2009, 07:01
Location: France

Postby gildas » 24 Mar 2009, 07:53

Hi,

I had also some issues behind my proxy with .NET Unity SFS client. But when I tried with the AS client (with the game "BattleFarm") it worked fine.

So, I have compared data transfered over the network for both.
For Battle Farm I had request such as:
POST http://myproxyip/BlueBox/HttpBox.do HTTP/1.1

For Unity SFS client :
POST HttpBox.do HTTP/1.0

So I looked into the source code of .NET SmartFoxClient and inside the method HttpSendViaSockets I have found the following code :
sb.Append("POST "+servletUrl +"HTTP/1.0....
with servletUrl = "BlueBox/HttpBox.do...."
I have replaced servletUrl by webUrl in the code, with
webUrl = "http://"+ipAddr+":"+port+"/"+servletUrl
(ipAddr is the smartfoxserver ip)

And I have also "hard coded" :-( for now my ip proxy in order that in HttpSendViaSockets the TcpClient connection is open with the proxy IP and not directly with the SFS ip), and it works.
The last problem I have not solved is that I don't know how to find automatically the ip of my proxy...

Hope it can help...
if you are interested by the code let me know
(I am not a network guy so maybe I am not doing things in the right way)
Gildas

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 8 guests