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

Function newHandle

lib/internal/dgram.js:31–60  ·  view source on GitHub ↗
(type, lookup)

Source from the content-addressed store, hash-verified

29}
30
31function newHandle(type, lookup) {
32 if (lookup === undefined) {
33 if (dns === undefined) {
34 dns = require('dns');
35 }
36
37 lookup = dns.lookup;
38 } else {
39 validateFunction(lookup, 'lookup');
40 }
41
42 if (type === 'udp4') {
43 const handle = new UDP();
44
45 handle.lookup = FunctionPrototypeBind(lookup4, handle, lookup);
46 return handle;
47 }
48
49 if (type === 'udp6') {
50 const handle = new UDP();
51
52 handle.lookup = FunctionPrototypeBind(lookup6, handle, lookup);
53 handle.bind = handle.bind6;
54 handle.connect = handle.connect6;
55 handle.send = handle.send6;
56 return handle;
57 }
58
59 throw new ERR_SOCKET_BAD_TYPE();
60}
61
62
63function _createSocketHandle(address, port, addressType, fd, flags) {

Callers 2

SocketFunction · 0.85
_createSocketHandleFunction · 0.85

Calls 1

requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…