MCPcopy Index your code
hub / github.com/nodejs/node / getSocket

Function getSocket

test/parallel/test-dgram-send-error.js:12–24  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

10const mockError = new Error('mock DNS error');
11
12function getSocket(callback) {
13 const socket = dgram.createSocket('udp4');
14
15 socket.on('message', common.mustNotCall('Should not receive any messages.'));
16 socket.bind(common.mustCall(() => {
17 socket[kStateSymbol].handle.lookup = function(address, callback) {
18 process.nextTick(callback, mockError);
19 };
20
21 callback(socket);
22 }));
23 return socket;
24}
25
26getSocket(common.mustCall((socket) => {
27 socket.on('error', common.mustCall((err) => {

Callers 1

Calls 4

createSocketMethod · 0.80
callbackFunction · 0.70
onMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…