%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/vittasync.vacivitta.com.br/vittasync/node/test/internet/
Upload File :
Create Path :
Current File : /home/vacivi36/vittasync.vacivitta.com.br/vittasync/node/test/internet/test-dgram-membership.js

'use strict';

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

const setup = dgram.createSocket.bind(dgram, { type: 'udp4', reuseAddr: true });

// addMembership() with valid socket and multicast address should not throw
{
  const socket = setup();
  socket.addMembership(multicastAddress);
  socket.close();
}

// dropMembership() without previous addMembership should throw
{
  const socket = setup();
  assert.throws(
    () => { socket.dropMembership(multicastAddress); },
    /^Error: dropMembership EADDRNOTAVAIL$/,
  );
  socket.close();
}

// dropMembership() after addMembership() should not throw
{
  const socket = setup();
  socket.addMembership(multicastAddress);
  socket.dropMembership(multicastAddress);
  socket.close();
}

Zerion Mini Shell 1.0