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

Function onsend

benchmark/dgram/offset-length.js:24–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 const socket = dgram.createSocket('udp4');
23
24 function onsend() {
25 if (sent++ % n === 0) {
26 // The setImmediate() is necessary to have event loop progress on OSes
27 // that only perform synchronous I/O on nonblocking UDP sockets.
28 setImmediate(() => {
29 for (let i = 0; i < n; i++) {
30 socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend);
31 }
32 });
33 }
34 }
35
36 socket.on('listening', () => {
37 bench.start();

Callers 1

mainFunction · 0.70

Calls 2

sendMethod · 0.65
setImmediateFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…