11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (!common.hasIPv6) 51cb0ef41Sopenharmony_ci common.skip('no IPv6 support'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst dgram = require('dgram'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci// This test ensures that dual-stack support is disabled when 101cb0ef41Sopenharmony_ci// we specify the `ipv6Only` option in `dgram.createSocket()`. 111cb0ef41Sopenharmony_ciconst socket = dgram.createSocket({ 121cb0ef41Sopenharmony_ci type: 'udp6', 131cb0ef41Sopenharmony_ci ipv6Only: true, 141cb0ef41Sopenharmony_ci}); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_cisocket.bind({ 171cb0ef41Sopenharmony_ci port: 0, 181cb0ef41Sopenharmony_ci address: '::', 191cb0ef41Sopenharmony_ci}, common.mustCall(() => { 201cb0ef41Sopenharmony_ci const { port } = socket.address(); 211cb0ef41Sopenharmony_ci const client = dgram.createSocket('udp4'); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci // We can still bind to '0.0.0.0'. 241cb0ef41Sopenharmony_ci client.bind({ 251cb0ef41Sopenharmony_ci port, 261cb0ef41Sopenharmony_ci address: '0.0.0.0', 271cb0ef41Sopenharmony_ci }, common.mustCall(() => { 281cb0ef41Sopenharmony_ci client.close(); 291cb0ef41Sopenharmony_ci socket.close(); 301cb0ef41Sopenharmony_ci })); 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci client.on('error', common.mustNotCall()); 331cb0ef41Sopenharmony_ci})); 34