11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst dgram = require('dgram'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst client = dgram.createSocket('udp4'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cilet interval; 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciclient.on('message', common.mustCall(function onMessage(buf, info) { 131cb0ef41Sopenharmony_ci const expected = Buffer.alloc(0); 141cb0ef41Sopenharmony_ci assert.ok(buf.equals(expected), `Expected empty message but got ${buf}`); 151cb0ef41Sopenharmony_ci clearInterval(interval); 161cb0ef41Sopenharmony_ci client.close(); 171cb0ef41Sopenharmony_ci})); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciclient.on('listening', common.mustCall(function() { 201cb0ef41Sopenharmony_ci interval = setInterval(function() { 211cb0ef41Sopenharmony_ci client.send([], client.address().port, common.localhostIPv4); 221cb0ef41Sopenharmony_ci }, 10); 231cb0ef41Sopenharmony_ci})); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ciclient.bind(0); 26