2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2013-04-18 00:44:53 +02:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
|
|
|
var dgram = require('dgram');
|
|
|
|
|
2015-03-17 12:06:48 +11:00
|
|
|
// skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface
|
|
|
|
if (common.inFreeBSDJail) {
|
|
|
|
console.log('1..0 # Skipped: In a FreeBSD jail');
|
2015-07-07 20:55:55 +05:30
|
|
|
return;
|
2015-03-17 12:06:48 +11:00
|
|
|
}
|
|
|
|
|
2013-04-18 00:44:53 +02:00
|
|
|
dgram.createSocket('udp4').bind(common.PORT + 0, common.mustCall(function() {
|
|
|
|
assert.equal(this.address().port, common.PORT + 0);
|
|
|
|
assert.equal(this.address().address, '0.0.0.0');
|
|
|
|
this.close();
|
|
|
|
}));
|
|
|
|
|
2014-08-02 12:42:42 +04:00
|
|
|
if (!common.hasIPv6) {
|
2015-07-06 03:24:12 +00:00
|
|
|
console.log('1..0 # Skipped: udp6 part of test, because no IPv6 support');
|
2014-08-02 12:42:42 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-18 00:44:53 +02:00
|
|
|
dgram.createSocket('udp6').bind(common.PORT + 1, common.mustCall(function() {
|
|
|
|
assert.equal(this.address().port, common.PORT + 1);
|
2013-04-19 08:32:24 -07:00
|
|
|
var address = this.address().address;
|
|
|
|
if (address === '::ffff:0.0.0.0')
|
|
|
|
address = '::';
|
|
|
|
assert.equal(address, '::');
|
2013-04-18 00:44:53 +02:00
|
|
|
this.close();
|
|
|
|
}));
|