mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
93982c0a3d
PR-URL: https://github.com/nodejs/node/pull/11277 Reviewed-By: James M Snell <jasnell@gmail.com>
24 lines
539 B
JavaScript
24 lines
539 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const dgram = require('dgram');
|
|
|
|
{
|
|
const socket = dgram.createSocket('udp4');
|
|
|
|
assert.throws(() => {
|
|
socket.setMulticastLoopback(16);
|
|
}, /^Error: setMulticastLoopback EBADF$/);
|
|
}
|
|
|
|
{
|
|
const socket = dgram.createSocket('udp4');
|
|
|
|
socket.bind(0);
|
|
socket.on('listening', common.mustCall(() => {
|
|
assert.strictEqual(socket.setMulticastLoopback(16), 16);
|
|
assert.strictEqual(socket.setMulticastLoopback(0), 0);
|
|
socket.close();
|
|
}));
|
|
}
|