2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-01-28 15:59:35 -08:00
|
|
|
const common = require('../common');
|
2016-11-21 11:05:24 -08:00
|
|
|
const assert = require('assert');
|
2014-07-02 15:24:17 +02:00
|
|
|
|
2016-05-29 17:53:40 +02:00
|
|
|
if (common.isOSX) {
|
2016-05-11 15:34:52 -04:00
|
|
|
common.skip('because of 17894467 Apple bug');
|
2014-08-02 15:06:25 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-11-21 11:05:24 -08:00
|
|
|
const dgram = require('dgram');
|
|
|
|
|
2016-01-28 15:59:35 -08:00
|
|
|
const client = dgram.createSocket('udp4');
|
2014-07-02 15:24:17 +02:00
|
|
|
|
2016-11-21 11:05:24 -08:00
|
|
|
client.bind(0, common.mustCall(function() {
|
2016-05-29 03:06:56 -04:00
|
|
|
const port = this.address().port;
|
2014-07-02 15:24:17 +02:00
|
|
|
|
2016-11-21 11:05:24 -08:00
|
|
|
client.on('message', common.mustCall(function onMessage(buffer) {
|
|
|
|
assert.strictEqual(buffer.length, 0);
|
|
|
|
clearInterval(interval);
|
2016-05-29 03:06:56 -04:00
|
|
|
client.close();
|
|
|
|
}));
|
2014-07-02 15:24:17 +02:00
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
const buf = Buffer.alloc(0);
|
2017-01-08 13:19:00 +00:00
|
|
|
const interval = setInterval(function() {
|
2016-11-21 11:05:24 -08:00
|
|
|
client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall(function() {}));
|
|
|
|
}, 10);
|
|
|
|
}));
|