11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst net = require('net'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_cifunction check(addressType) { 61cb0ef41Sopenharmony_ci const server = net.createServer(function(client) { 71cb0ef41Sopenharmony_ci client.end(); 81cb0ef41Sopenharmony_ci server.close(); 91cb0ef41Sopenharmony_ci }); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci const address = addressType === 4 ? '127.0.0.1' : '::1'; 121cb0ef41Sopenharmony_ci server.listen(0, address, function() { 131cb0ef41Sopenharmony_ci net.connect(this.address().port, address) 141cb0ef41Sopenharmony_ci .on('lookup', common.mustNotCall()); 151cb0ef41Sopenharmony_ci }); 161cb0ef41Sopenharmony_ci} 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cicheck(4); 191cb0ef41Sopenharmony_cicommon.hasIPv6 && check(6); 20