1

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 ?

mpromonet
  • 11,326
  • 43
  • 62
  • 91
atul
  • 168
  • 1
  • 14

2 Answers2

1

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.

binji
  • 1,860
  • 9
  • 9
0

I managed to get this working on pepper_49 with Google Chrome 54.0.2840.59 (64-bit).

First step is to make sure that you have nothing NACL related features enabled in chrome://flags. I think I had #allow-nacl-socket-api turned on, and it will not work, even if you pass the correct command line argument. restore them back to default!

Second, make sure you do not have any other instances of Chrome running. For some reason, it won't work if another instance of chrome is running prior to launching chrome with the proper command line argument.

And then, the final step (credit goes to @binji for this step), launch chrome from the command line with this argument:

google-chrome --allow-nacl-socket-api=localhost

then go to http://localhost:5103/api/socket. This time, you should have this:

tcp
Resolving ...
Resolved: 127.0.0.1:80
Connecting ...
Connected
mchiasson
  • 2,452
  • 25
  • 27