summaryrefslogtreecommitdiff
path: root/test/parallel/test-dgram-send-callback-buffer-empty-address.js
blob: 5b3b1c41a1917c2d259a00d70e2ca17676d0734b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');

const client = dgram.createSocket('udp4');

const buf = Buffer.alloc(256, 'x');

const onMessage = common.mustCall(function(err, bytes) {
  assert.ifError(err);
  assert.strictEqual(bytes, buf.length);
  client.close();
});

client.bind(0, () => client.send(buf, client.address().port, onMessage));