1'use strict'; 2 3const common = require('../common'); 4const assert = require('assert'); 5const dgram = require('dgram'); 6 7const client = dgram.createSocket('udp4'); 8 9const buf = Buffer.alloc(256, 'x'); 10 11const onMessage = common.mustCall(function(err, bytes) { 12 assert.ifError(err); 13 assert.strictEqual(bytes, buf.length); 14 client.close(); 15}); 16 17client.bind(0, () => client.send(buf, client.address().port, onMessage)); 18