mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
516 B
23 lines
516 B
13 years ago
|
var common = require('../common'),
|
||
|
assert = require('assert'),
|
||
|
dgram = require('dgram'),
|
||
|
thrown = false,
|
||
|
socket = dgram.createSocket('udp4');
|
||
|
|
||
|
socket.bind(common.PORT);
|
||
13 years ago
|
socket.on('listening', function () {
|
||
|
socket.setMulticastTTL(16);
|
||
13 years ago
|
|
||
13 years ago
|
//Try to set an invalid TTL (valid ttl is > 0 and < 256)
|
||
|
try {
|
||
|
socket.setMulticastTTL(1000);
|
||
|
} catch (e) {
|
||
|
thrown = true;
|
||
|
}
|
||
13 years ago
|
|
||
13 years ago
|
assert(thrown, 'Setting an invalid multicast TTL should throw some error');
|
||
13 years ago
|
|
||
13 years ago
|
//close the socket
|
||
|
socket.close();
|
||
|
});
|