You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
472 B

'use strict';
require('../common');
const assert = require('assert');
const TCP = process.binding('tcp_wrap').TCP;
const uv = process.binding('uv');
const handle = new TCP();
// Should be able to bind to the port
let err = handle.bind('0.0.0.0', 0);
assert.strictEqual(err, 0);
// Should not be able to bind to the same port again
const out = {};
handle.getsockname(out);
err = handle.bind('0.0.0.0', out.port);
assert.strictEqual(err, uv.UV_EINVAL);
handle.close();