nodejs/test/parallel/test-tcp-wrap.js

19 lines
444 B
JavaScript
Raw Normal View History

'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;
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
var err = handle.bind('0.0.0.0', common.PORT);
assert.equal(err, 0);
2011-06-09 15:31:51 +02:00
// Should not be able to bind to the same port again
err = handle.bind('0.0.0.0', common.PORT);
assert.equal(err, uv.UV_EINVAL);
2011-06-09 15:31:51 +02:00
handle.close();