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

Function runClient

test/pummel/test-net-many-clients.js:44–80  ·  view source on GitHub ↗
(port, callback)

Source from the content-addressed store, hash-verified

42});
43
44function runClient(port, callback) {
45 const client = net.createConnection(port);
46
47 client.connections = 0;
48
49 client.setEncoding('utf8');
50
51 client.on('connect', function() {
52 console.log('c');
53 client.recved = '';
54 client.connections += 1;
55 });
56
57 client.on('data', function(chunk) {
58 this.recved += chunk;
59 });
60
61 client.on('end', function() {
62 client.end();
63 });
64
65 client.on('close', common.mustCall(function(had_error) {
66 assert.strictEqual(had_error, false);
67 assert.strictEqual(client.recved.length, bytes);
68
69 if (client.fd) {
70 console.log(client.fd);
71 }
72 assert.ok(!client.fd);
73
74 if (this.connections < connections_per_client) {
75 this.connect(port);
76 } else {
77 callback();
78 }
79 }, connections_per_client));
80}
81
82server.listen(0, function() {
83 let finished_clients = 0;

Callers 1

Calls 8

connectMethod · 0.65
callbackFunction · 0.50
createConnectionMethod · 0.45
setEncodingMethod · 0.45
onMethod · 0.45
logMethod · 0.45
endMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…