1'use strict'; 2 3const common = require('../common'); 4 5const assert = require('assert'); 6const dgram = require('dgram'); 7 8const client = dgram.createSocket('udp4'); 9 10client.on('message', common.mustCall((buf, info) => { 11 const expected = Buffer.alloc(0); 12 assert.ok(buf.equals(expected), `Expected empty message but got ${buf}`); 13 client.close(); 14})); 15 16client.on('listening', common.mustCall(() => { 17 client.connect(client.address().port, 18 common.localhostIPv4, 19 common.mustCall(() => client.send([]))); 20})); 21 22client.bind(0); 23