What proxy server can we use?

I want to experiment using a proxy server to solve (web)game connection problems. Luckily unity provides us with the option. However, what proxy server can we run?

I tried installing squid on Centos, and verified that this http proxy worked. I couldn’t start a multiplayer server using this proxy though. I set the right port and IP but squid didn’t even log any connection. Unity complained about not being able to start the server due to being unable to reach the proxy.

Did anyone successfully set up a proxy yet? What setup works?

The same problem. Browser proxy settings not affect to WWW class requests in web-player.

It seems that even http://www.fusionfall.com/ (biggest unity3d on-line game) do not solve this problem (friezes on start load asset bundles).

This problem happens when web Browser set-up to use some special proxy server like proxy.example.org:3128.

It is great problem, cause many peoples connects to Internet through the non transparent proxy servers.

P.S. I duno which way WWW class uses the Browser API, when it work with cache, but not work with proxy at same time.

has anyone of you ever tested if the Network.proxyxxxx settings have any impact on the proxy behavior of WWW? Or if they are purely related to Unitys multiplayer capability.

Nope, since I haven’t even be able to use a proxy for the unity networking itself

Nope to get it to work or nope to the WWW part?

Just to clarify that: Unity is not interested in your systems proxy config, you would have to tell it to use the proxy and enter the proxy details in the corresponding Network.xxx fields.

Thx! But this try was not success, I mean this:

Network.proxyIP = "192.168.0.1";
Network.proxyPort = 3128;

I think as logical that position: “If you are work as web player, you by default use browser API for make requests, and you do not know proxy or other things like this”. This is not exclude that class may have non-default tuning.

Any other ideas? Office workers of all world, waiting for our web games :slight_smile: They all usually behind a proxy, its luck if it transparent.

P.S. Sorry for may Russian-English, I hope my opinion is clear.

Well its a game technology, not a browser, so I don’t see why it should use configs that are meant for a browser, especially as not all proxys offer UDP due to the massive missuse of proxys for P2P.

Are you sure that you didn’t mess the IP and really wanted to use your local lan router as your proxy?
Additional things:

  1. is the proxy without password?
  2. did you set useProxy, otherwise proxy configs are ignored

for more, please see http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=network

and last but not least. did you test if the unity networking works or did you only test WWW?

Potentially above will set the System.NET proxy to the same as you set the network (which is raknet, not System.NET based), but if not you could also set it through the corresponding system net end and test it.
See here: http://www.hccp.org/csharp-http-proxy.html

Well its a game technology, not a browser, so I
don’t see why it should use configs that are meant
for a browser,

I think webplayer is not so complex as web browser, so no needs to poor emulate web browser functions if exists ability for browser API using. This needs only for standalone games.

In other words, if webplayer have web browser as parent object, so it may to use browser methods, as it usual in OPP style .

Are you sure that you didn’t mess the IP and
really wanted to use your local lan router as your
proxy?

We was try to use local and global address (on other machine with global IP). My Linux router is my proxy (Squid), no mistake there.

Additional things:

  1. is the proxy without password?

No. But I have this kind of proxy to, and was try to use it.

  1. did you set useProxy, otherwise proxy configs
    are ignored

Yes I do.

for more, please see http://unity3d.com/support
/documentation/ScriptReference
/30_search.html?q=network
and last but not least. did you test if the unity
networking works or did you only test WWW?

Do not test networking, I think there nothing to test. WWW class works perfectly without proxy, this tested on several computers.

Potentially above will set the System.NET proxy to
the same as you set the network (which is raknet,
not System.NET based), but if not you could also
set it through the corresponding system net end
and test it.

See here: http://www.hccp.org/csharp-
http-proxy.html[/quote]

thx immediately!

Actualy, my the script is:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Net;

void Awake()
	{

//global proxy ip
	Network.proxyIP = "77.66.145.184";
	Network.proxyPort = 3128;
	Network.useProxy = true;

/*
// other example behind the NAT 
Network.natFacilitatorIP = "192.168.0.1";
Network.natFacilitatorPort = 3128;
Network.useNat = true;
*/

/*

//or for proxy with user/password behind the NAT 
System.Uri proxyURI = new System.Uri("http://192.168.0.1:3128");
  System.Net.WebProxy proxy = new System.Net.WebProxy(proxyURI);
  proxy.Credentials = new System.Net.NetworkCredential("USER", "PASSWORD");
  WebRequest.DefaultWebProxy = proxy;

*/

	}


void start(){

   WWW w = new WWW("http://www.kembl.ru");

}

and then i seek for activity in the squid access log files.

So this one works or thats the script you had for testing that didn’t work?

No, no one works. Just error

You are trying to load data from a www stream which had the following error when downloading.
couldn't connect to host
UnityEngine.WWW:get_texture()
UnityEngine.WWW:get_texture()
<>c__CompilerGenerated2:MoveNext() (at Assets\Network\CNetObjectsLoad.cs:103)

[..\..\Runtime\Export\[url]WWW.cpp[/url] line 652]

The proxy host is reachable. May be this mean, that destination point not reachable, but in squid access logs nothing appear to.

May be exists some kind of undocumented method like

www.bytes = 0x1231261253561a266d6127f…

We need only assetbundle download ability, so we can get it like bytes with other technique, and then load bytes in to WWW class.

Other idea. Load bundles through javascript (so browser works it self), but how to interoperate between two *.unity3d files on page? By javascript? It is slow method (i think, but not tested yet), or may be we can set direct link between resources in two webplayers on one page?

you can not interporate between to unity3d files. you can only load one at a time, loading the other removes the first.

Question is how many are affected by proxys? because at least here in europe the only ones behind proxys are those who are not meant (and often not capable) to play games anyway.

I mean load it by call external javascript with parameter in to different html frame/div, and then interoperate, may be through serialisation, this is only idea.

I hope problem is not so big: biggest percent of proxies are transparent and not a problem.

But this interest question it self, I think 20% office workers surf on Internet in Europe/USA, and may be 3-4% of it looking for games. It is much more than several millions.

We are Russian oriented, and Russia have no such big numbers (only 20 million peoples (all ~146 mil.) have Internet), but i think one or two millions of peoples, waste its time in internet from offices, and as usual in Russia, they have corporate proxies, which allows only WEB connections.

Plus home networks, for several owners with one router.

I think the proxy using problem have one more important side. When you have big web project, proxy allows to decrease main web servers cluster loading, increase access speed and decrease servers farm traffic prices (if they exists). So if you can pay several days work time for try to solve this problem, this activity can save hardware loading and money in future. If you open this technology for others, you will help to save world traffic and time globally. 8)

So, did your proxy setup actually work for the regular unity networking?

Using your IP/port here didn’t work for me. Furthermore I’m still not sure what proxy server I should setup that I can use. Squid doesn’t seem to work since it’s not a UDP proxy(?). RakNet’s UDPProxy example project didn’t seem to work either.

Has anyone actually got the unity proxy feature working? If so; what proxy server are you using?

Why do you need UDP proxy?
The main, unique thing in WWW class that it works with AssetBundles. No way handle that with out this class. If your program do not needs to load AssetBundles, you can use direct connection to Proxy IP:Port, see:

This is example of direct request to the site

http://forum.unity3d.com/posting.php?mode=reply&t=30852

GET /posting.php?mode=reply&t=30852 HTTP/1.0
Host: forum.unity3d.com
Accept-Language: ru,en-us;q=0.7,en;q=0.3
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7

after request, site answer with page content.

And this is request to PROXY IP:Port

GET [url]http://forum.unity3d.com/posting.php?mode=reply&t=30852[/url] HTTP/1.0
Host: forum.unity3d.com
Accept-Language: ru,en-us;q=0.7,en;q=0.3
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive

Main difference in first string, all other not so important, after request, proxy return page content.

So you can construct proper headers and directly talk with proxy.

If you wish to build game network for cooperative game between gamer behind the NAT and gamers in outer world, the simplest way to do this - router port mapping (setup by hand ) or uPNP (actually not know how) (www.upnpworks.alcidelic.com/links.html) (www.whitebear.ch) (http://miniupnp.free.fr/). More complex way to combine gamers - lobby or game server.

I’m trying to get the unity proxy (Network.useProxy etc.) working for the unity networking: Network.Connect, RPC’s and so on. And I don’t know if it’s UDP or not (just guessing so) but I need to know what proxy server works.

For solve the protocol question needs to start server with some port (7777 for example) , I mean

Network.InitializeServer(32, 7777);

and check with netstat command, which kind of port has LISTEN status: TCP or UDP.

netstat example (without any unity server):

[root@wserver1 home]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:619                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:10733             0.0.0.0:*                   LISTEN
tcp        0      0 :::2000                     :::*                        LISTEN
tcp        0      0 :::80                       :::*                        LISTEN
...

this is from Centos, but with windows / mac you’ll get the same results.

Hopefully I can clear a bit of confusion up. The WWW class, .NET WebProxy class used by System.Net.WebRequest and then the proxy setting for the inbuilt networking are all separate entities and do not affect one another. I.e. setting Network.useProxy does not affect the WWW class.

The WWW class uses the browser when running in the webplayer plugin and it should use whatever proxy setting the browser has. Testing this is of course only possible in an actual webplayer as the editor/standalones use different code.

The inbuilt networking Network.useProxy uses a separate proxy server which is available for download (yes it is UDP based like the whole networking layer). Contact me directly through email or PM to get it (I’ll send you a PM Leepo). I’ll make sure a download link for it is made publicly visible as soon as possible (seems to have disappeared).

Thx for useful answers!

Testing this is of course only
possible in an actual webplayer as the
editor/standalones use different code.

This is a “root of evil”.

Looks good, but for completely solution we need to answer only two questions:

  1. Which method to use WWW with proxy from Editor (for more fast code checks)? Is this theoretical possible?

  2. Which method to define where app working (on web browser or in editor and, I think that I saw solution on forum) for select when use 1) (from editor) and when not (from webapp).