Search Unity

Working Behind a Proxy

Discussion in 'Multiplayer' started by WiseGuy, Mar 1, 2010.

  1. WiseGuy

    WiseGuy

    Joined:
    Mar 1, 2009
    Posts:
    33
    Hi
    I need to make WWW requests from behind a proxy but im failing :(

    Currently im Doing This :

    Code (csharp):
    1.  
    2. var cr = new System.Net.NetworkCredential("user","pass");
    3. dNetProxy = new System.Net.WebProxy(proxyIP_+":"+proxyPort_);
    4. dNetProxy.set_Credentials(cr);
    5. System.Net.WebRequest.DefaultWebProxy = dNetProxy;
    6.  
    7.  
    I do it once the Proxy settings are confirmed by the user. do i need to set it before every WWW request ?

    Another thing that im worried about is that Network.useProxy which i wil need for the multiplayer part doesn't have a field for Username ?
     
  2. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Network.useProxy uses a custom (RakNet based?) proxy server, without usernames indeed.
     
  3. WiseGuy

    WiseGuy

    Joined:
    Mar 1, 2009
    Posts:
    33
    Mmm, so if i want to do Multiplayer behind a Proxy i have to use the specified RakNet Proxy Server ?
     
  4. WiseGuy

    WiseGuy

    Joined:
    Mar 1, 2009
    Posts:
    33
    I also read that the WWW class, the System.Net.WebRequest and Network class have no relation at all !!!

    This means that changing the settings in System.Net.WebRequest is not going to influence the WWW class at all ?!?!

    If this is all true, then how do i get past a proxy with WWW. I do not want to rewrite all the function of the WWW in System.Net.WebRequest if i dont have to ...
     
  5. Quietus2

    Quietus2

    Joined:
    Mar 28, 2008
    Posts:
    2,058
    There was a bug I reported, where I found Unity giving very unreliable response to proxy settings and the WWW class in varying circumstances.

    It would ignore the proxy defined in the system settings when using a stand-alone build on osX. It would pick them up when running in a webplayer in safari, but ignored them in firefox.

    The bug report number was 255804, reported back in 7/2009. It appears to still be open so I assume the problem still exists.