socketstcpgoogle-nativeclientppapi

Running socket API for native client


I am trying to run the socket api example provided by goggle native client.(path : nacl_sdk\pepper_35\examples\api\socket)

I am able to build and run this example using make command, also it is displayed properly on chrome browser. But when I try to connect to some TCP port it always fails irrespective of IP and PORT.Though I have created an application which listens on a specific port on my machine.

Following is the error message:

tcp
Resolving ...
Resolve failed.

I can not even create the local server by providing only the port number.It says:

Starting server on port: 8080
server: Bind failed with: -7

Following changes are already done:

  1. enable nacl on chrome
  2. enable nacl socket api on chrome

Following things have been tried:

  1. launching chrome using command line arguments "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-nacl-socket-api="http://localhost"

  2. "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-nacl-socket-api=IP_ADDRESS_OF_MY_SYSTEM

Can anyone tell what am I missing here ?


Solution

  • The correct argument is:

    --allow-nacl-socket-api=localhost
    

    The argument must be just the origin, and it must be the origin where that is trying to access sockets. Your IP address doesn't work because the page you are loading isn't specified with an IP address. The arguments must match exactly, or all socket calls will fail.