Tag: ipv6

Inexplicable node.js http抛出连接ECONNREFUSED(IPv6?)

我正在运行node.js,如下所示: > http = require('http') > http.get('http://myhost.local:8080', function (res) { console.log("RES" + res) } ).on('error', function (e) { console.log("Error:", e) }) > uri = require('url').parse("http://myhost.local:8080") { protocol: 'http:', slashes: true, auth: null, host: 'myhost.local:8080', port: '8080', hostname: 'myhost.local', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://myhost.local:8080/' } > http.get(uri, function (res) […]

采用Node.js的IPv6组播

我正在通过VPN试验IPv6 UDP多播。 我已经尝试了下面的代码: const dgram = require('dgram'); let sock = dgram.createSocket('udp6', { reuseAddr: true }); sock.on('message', (data, source) => { console.log('on message', arguments); }); sock.bind('36912', '2620:9b::1944:e598', () => { sock.addMembership('ff02::1:3', '2620:9b::1944:e598'); }); setInterval(() => { let buf = Buffer.from((new Date()).toString()); sock.send(buf, 0, buf.length, 36912, 'ff02::1:3'); }, 500); 脚本运行,我看到数据包是用Wireshark发送/接收的,但是两端都没有显示在控制台中。 我究竟做错了什么? 使用IPv6发送和接收基本组播的方式是什么?

使用WebSocket接口调用IPV6 IP

[ 我已经标记了这个问题,被版主删除,直到我得到我的这个问题的答案 ] 我的javascript客户端工作正常时通过与IPV4 IP地址的WebSocket接口与node.js(在Ubuntu上,更多这里 )服务器通话。 即使我的主机提供商已经准备好分配给我IPV4,但是现在让我使用IPV6,因为现在IPV4的供应有限。 当使用IPV6 IP时,我得到这个错误: WebSocket连接到'ws:// [2600:3c00 :: f03c:91ff:fe73:2b08]:31333 /'失败:连接build立时出错:net :: ERR_ADDRESS_UNREACHABLE 我已经检查,端口31333确实是使用工具打开: http : //www.subnetonline.com/pages/ipv6-network-tools/online-ipv6-port-scanner.php 我甚至尝试过的解决scheme,如IPv6地址给Internet Explorer-10 websocket的语法错误 – 那就是:2600-3c00-0-0-f03c-91ff-fe73-2b08.ipv6-literal.net 我已经运行这个客户端,并且能够在基于远程Ubuntu的服务器上运行时连接到服务器: var WebSocket = require('ws') , ws = new WebSocket('ws://[2600:3c00::f03c:91ff:fe73:2b08]:31333'); ws.on('open', function() { ws.send('something'); }); ws.on('message', function(message) { console.log('received: %s', message); }); 但是,当我从家里的Windows 7运行这个相同的客户端,而服务器是远程Ubuntu的,它不能够连接: > $ node c2.js events.js:85 > […]

Node.js server.address()。address returns ::

如果我没有记错的话,前几天用来显示“localhost”。 我不知道是什么改变了server.address()。地址返回双冒号(::)代替。 我在这里读到它返回一个IPv6地址(::),如果它可用但它在我的PC上被禁用。 https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback