summaryrefslogtreecommitdiff
path: root/test/parallel/test-tcp-wrap.js
blob: 18b8fe401f8902899b95dc71c3240401ec5a4d09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';
require('../common');
var assert = require('assert');

var TCP = process.binding('tcp_wrap').TCP;
var uv = process.binding('uv');

var handle = new TCP();

// Should be able to bind to the port
var err = handle.bind('0.0.0.0', 0);
assert.equal(err, 0);

// Should not be able to bind to the same port again
var out = {};
handle.getsockname(out);
err = handle.bind('0.0.0.0', out.port);
assert.equal(err, uv.UV_EINVAL);

handle.close();