node/test/simple/test-net-eaddrinuse.js

15 lines
394 B
JavaScript
Raw Normal View History

2010-12-05 07:20:34 +08:00
var common = require('../common');
var assert = require('assert');
var net = require('net');
2010-12-05 06:45:52 +08:00
var server1 = net.createServer(function(socket) {
});
2010-12-05 06:45:52 +08:00
var server2 = net.createServer(function(socket) {
});
2010-10-24 02:22:24 +08:00
server1.listen(common.PORT);
server2.addListener('error', function(error) {
assert.equal(true, error.message.indexOf('EADDRINUSE') >= 0);
server1.close();
});
2010-10-24 02:22:24 +08:00
server2.listen(common.PORT);