Hi, I’m developping a new game and I’m facing an Issue here.
I Read somewhere that unity only handle proxies on webplayer mode but I need to make connection online in iOS/Android/Mac/Win.
I tried using the class Network with useProxy and Connect but I tested it on two proxies configuration and it doesn’t seem to connect to it. And my www resquest just fail whenever I try to use this in a StandAlone on Windows…
How can I handle this issue?
I read that I need to add multiple environnement variable in my system (HTTPS_proxy/HTTP_proxy) but it’s for a client and I basicly need a simpler solution than configuring every single piece of computer the client will use the application if there’s such…
Thanks!
I just read that whatever proxies settings you put in your Network(useProxy, ip, port…), it won’t affect any of the WWW class, it’s two separate things.
My new question is : is there a class (like WWW) made to retrieve/send data which is using the Network proxy data ???
Thanks!
So, after wasting 24h on that subjet I tried to rewrite all my code using the HttpWebRequest instead of WWW. And I have to say this is working perfect because this class have a built-in proxy variable!
Instead of this :
form = new WWWForm();
form.AddField("email", strUserID);
form.AddField("password", strPassword);
w = new WWW(url, form);
yield return w;
I use this :
HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create (Const.LOGIN_URL);
httpWebRequest.Proxy = proxy;
HttpWebResponse httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream = new StreamReader(httpWebResponse.GetResponseStream(),enc);
response = loResponseStream.ReadToEnd();
loResponseStream.Close();
httpWebResponse.Close();
The only thing that can be an issue is that you cannot yield on these one whereas you can with the WWW, but I implemented a thread system and it’s working perfect. Hope that will help someone one day ( or maybe future me in 5 years ) 