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.
 
 
 
 
 
 

23 lines
523 B

'use strict';
require('../common');
const assert = require('assert');
const net = require('net');
// Using port 0 as localPort / localAddress is already invalid.
connect({
host: 'localhost',
port: 0,
localPort: 'foobar',
}, /^TypeError: "localPort" option should be a number: foobar$/);
connect({
host: 'localhost',
port: 0,
localAddress: 'foobar',
}, /^TypeError: "localAddress" option must be a valid IP: foobar$/);
function connect(opts, msg) {
assert.throws(() => {
net.connect(opts);
}, msg);
}