0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-net-dns-lookup.js
HUANG Wei 545b8fd8d8 net: emit host in lookup event
Previously, we emitted ip and addressType. This change includes the host
as the last argument to the lookup event.

PR-URL: https://github.com/nodejs/node/pull/5598
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-03-18 11:04:02 -05:00

26 lines
573 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var net = require('net');
var ok = false;
var server = net.createServer(function(client) {
client.end();
server.close();
});
server.listen(common.PORT, '127.0.0.1', function() {
net.connect(common.PORT, 'localhost')
.on('lookup', function(err, ip, type, host) {
assert.equal(err, null);
assert.equal(ip, '127.0.0.1');
assert.equal(type, '4');
assert.equal(host, 'localhost');
ok = true;
});
});
process.on('exit', function() {
assert(ok);
});