blob: f4624358a4fab47be86131f685973d1af6d076cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
'use strict';
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');
const socket = dgram.createSocket('udp4');
socket.on('listening', common.mustCall(() => {
assert.throws(() => {
socket.bind();
}, /^Error: Socket is already bound$/);
socket.close();
}));
const result = socket.bind(); // should not throw
assert.strictEqual(result, socket); // should have returned itself
|