1'use strict'; 2 3const common = require('../common'); 4if (!common.hasIPv6) 5 common.skip('no IPv6 support'); 6 7const dgram = require('dgram'); 8 9// This test ensures that dual-stack support is disabled when 10// we specify the `ipv6Only` option in `dgram.createSocket()`. 11const socket = dgram.createSocket({ 12 type: 'udp6', 13 ipv6Only: true, 14}); 15 16socket.bind({ 17 port: 0, 18 address: '::', 19}, common.mustCall(() => { 20 const { port } = socket.address(); 21 const client = dgram.createSocket('udp4'); 22 23 // We can still bind to '0.0.0.0'. 24 client.bind({ 25 port, 26 address: '0.0.0.0', 27 }, common.mustCall(() => { 28 client.close(); 29 socket.close(); 30 })); 31 32 client.on('error', common.mustNotCall()); 33})); 34