xref: /third_party/node/test/parallel/test-dgram-multicast-loopback.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst dgram = require('dgram');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci{
71cb0ef41Sopenharmony_ci  const socket = dgram.createSocket('udp4');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci  assert.throws(() => {
101cb0ef41Sopenharmony_ci    socket.setMulticastLoopback(16);
111cb0ef41Sopenharmony_ci  }, /^Error: setMulticastLoopback EBADF$/);
121cb0ef41Sopenharmony_ci}
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci{
151cb0ef41Sopenharmony_ci  const socket = dgram.createSocket('udp4');
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci  socket.bind(0);
181cb0ef41Sopenharmony_ci  socket.on('listening', common.mustCall(() => {
191cb0ef41Sopenharmony_ci    assert.strictEqual(socket.setMulticastLoopback(16), 16);
201cb0ef41Sopenharmony_ci    assert.strictEqual(socket.setMulticastLoopback(0), 0);
211cb0ef41Sopenharmony_ci    socket.close();
221cb0ef41Sopenharmony_ci  }));
231cb0ef41Sopenharmony_ci}
24

Indexes created Thu Nov 07 10:32:03 CST 2024