mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 17:01:08 +00:00

Replace common.PORT with available port assigned by the operating system in test-dgram-send-callback-buffer-empty-address. PR-URL: https://github.com/nodejs/node/pull/12929 Refs: https://github.com/nodejs/node/issues/12376 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
18 lines
418 B
JavaScript
18 lines
418 B
JavaScript
'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));
|