locked
[Help] About StreamSocket (javascript) error on Windows 8 metro RRS feed

  • Question

  • Sorry to disturb you.
    I met an issue when I use StreamSocket(javascript) to setup a socket connection via either http or https as below:
    WinRTError: An attempt was made to access a socket in a way forbidden by its access permissions

    PS: I've closed Windows Firewall, no proxy is used

    I refer to the codes in this link: http://msdn.microsoft.com/library/windows/apps/Hh780595

    Thanks in advance.


    No pains, no gains.

    Saturday, October 6, 2012 2:40 PM

Answers

  •  It works after I modified package.appexmanifest file to grant Internet access.

    No pains, no gains.

    Sunday, October 7, 2012 12:21 PM

All replies

  • The codes I used to connect to www.google.com via http are as below:

    clientSocket = new Windows.Networking.Sockets.StreamSocket();
    // Try to connect to google initially using HTTP
    serverHostName = new Windows.Networking.HostName("www.google.com");
    serverServiceName = "http";
    
    // Call ConnectAsync method to establish initial connection
    clientSocket.connectAsync(serverHostName, serverServiceName).done(onClientAccept, onConnectError);


    No pains, no gains.

    Saturday, October 6, 2012 2:47 PM
  •  It works after I modified package.appexmanifest file to grant Internet access.

    No pains, no gains.

    Sunday, October 7, 2012 12:21 PM