chrome.socket.connect returning error -102 when connecting to an IPV6 address on port 80

StackOverflow https://stackoverflow.com/questions/22967136

  •  30-06-2023
  •  | 
  •  

The following code is failing with a -102 error which according to net_error_list.h means 'Connection Refused'

chrome.socket.connect(
    socketId,

    '2001:1af8:fe9d:1:1454:de6a:7c96:70ba', // host 
    80,  // port

    function(errorCode){
        // errorCode = -102
    }
);

However if I change the port to any other open port it connects without issues.

Just to make sure its not a firewall/network related issue, I loaded the same host directly into a Chrome tab address bar and it worked succesfully.

I also did a telnet on that host/port without issues

telnet 2001:1cf7:fc9e:1:1543:fe6b:8c86:81bc 80 

If I connect to the same host using its IPV4 address it also works

chrome.socket.connect(
    socketId,

    '172.19.1.150', // host 
    80,  // port

    function(errorCode){
        // this works succesfully
    }
);

Any idea if this is a bug in the chrome.socket module or is this strictly something related to my network infrastructure?

有帮助吗?

解决方案

The deprecated chrome.socket has several problems including lack of IPv6 support. There are no plans to fix them. Migrate to chrome.sockets and you should be happier. As the documentation states, the new API supports IPv6.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top