locked
StreamSocket with proxy

    Question

  • Hi all,

    I'm writing an app that uses StreamSocket to communicate with servers. It works ok when the network has no proxy, but when the network requires a proxy and it is set in IE10 (and i guess that's the system proxy?) the app is not able to connect to the server anymore. Does anyone know how to solve this issue?

    Thanks!

    Anthony

    Wednesday, December 12, 2012 11:28 PM

Answers

  • Hi,

    It turns out that Windows 8 sockets, much like the socket libraries from other vendors, don’t include any mechanisms for getting through HTTP proxies. Looking at that, you have the following options -
    1. Attempt to get the proxy on their own. However, it’s difficult to get it to work.
    2. Use WebSockets, but only if the server on the other side also supports web sockets.  A web socket is a new technology that enables socket-like communication that will traverse proxies and firewalls.  However, it’s not compatible (on the wire) with normal sockets; the server should be able to support this. Since web sockets are new technology, not many existing servers do this.

    Your network administrators have chosen to block socket communication; see if they have a way to allow socket communication on the network.

    - Ashish Sahu [MSFT]

    • Marked as answer by A. Sham Friday, December 21, 2012 5:54 AM
    Tuesday, December 18, 2012 2:44 PM

All replies

  • Hello,

     

    Thanks for your feedback, I will involve more experts to investigate it.

     

    Best regards,

    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 14, 2012 3:12 AM
  • Hi Anthony,

    Can you please try the following command from an elevated command prompt and let us know if it helps? -

    netsh winhttp import proxy source=ie

    - Ashish [MSFT]

    Friday, December 14, 2012 6:37 PM
  • When I run the netsh command, it returned

    Current WinHTTP proxy settings:

        Direct access (no proxy server).

    But when I check IE, the proxy is set to configured thru a script ("Use automatic configuration script" is checked, and I know for a fact that we are using a proxy :)

    In the app I check if there's a proxy:   

    create_task( NetworkInformation::GetProxyConfigurationAsync( ref new Uri( PROXY_TEST_URI ) ) ).then( [ this ]( ProxyConfiguration^ conf )
        {
            bool has_proxy = !conf->CanConnectDirectly;
        } );

    and it returns false for CanConnectDirectly so my environment does have a proxy. When I move to a network without a proxy CanConnectDirectly returns true.

    I tested with BackgroundDownloader and it works in both environment (with/without proxy), but that's not an option for us to use that.

    Thanks for your help! Let me know if you need more information


    • Edited by A. Sham Friday, December 14, 2012 11:15 PM
    Friday, December 14, 2012 7:50 PM
  • Hi,

    It turns out that Windows 8 sockets, much like the socket libraries from other vendors, don’t include any mechanisms for getting through HTTP proxies. Looking at that, you have the following options -
    1. Attempt to get the proxy on their own. However, it’s difficult to get it to work.
    2. Use WebSockets, but only if the server on the other side also supports web sockets.  A web socket is a new technology that enables socket-like communication that will traverse proxies and firewalls.  However, it’s not compatible (on the wire) with normal sockets; the server should be able to support this. Since web sockets are new technology, not many existing servers do this.

    Your network administrators have chosen to block socket communication; see if they have a way to allow socket communication on the network.

    - Ashish Sahu [MSFT]

    • Marked as answer by A. Sham Friday, December 21, 2012 5:54 AM
    Tuesday, December 18, 2012 2:44 PM
  • Hi Anthony,

    How are you working  with StreamSocket with Proxy? I'm facing the same problem. So what decision you took to solve this problem? Please let me know.

    Regards,

    Somnath


    Friday, January 11, 2013 6:33 AM