2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2011-06-09 15:31:51 +02:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var TCP = process.binding('tcp_wrap').TCP;
|
2013-07-19 23:33:06 +02:00
|
|
|
var uv = process.binding('uv');
|
2011-06-09 15:31:51 +02:00
|
|
|
|
|
|
|
var handle = new TCP();
|
|
|
|
|
|
|
|
// Should be able to bind to the common.PORT
|
2013-07-19 23:33:06 +02:00
|
|
|
var err = handle.bind('0.0.0.0', common.PORT);
|
|
|
|
assert.equal(err, 0);
|
2011-06-09 15:31:51 +02:00
|
|
|
|
2011-07-14 13:59:37 -07:00
|
|
|
// Should not be able to bind to the same port again
|
2013-07-19 23:33:06 +02:00
|
|
|
err = handle.bind('0.0.0.0', common.PORT);
|
|
|
|
assert.equal(err, uv.UV_EINVAL);
|
2011-07-14 13:59:37 -07:00
|
|
|
|
2011-06-09 15:31:51 +02:00
|
|
|
handle.close();
|