Mercurial
view third_party/libuv/docs/code/multi-echo-server/hammer.js @ 161:87d8d3eb3491
[PostDog] WIP to make it more mordern looking
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 15 Jan 2026 08:29:26 -0800 |
| parents | 948de3f54cea |
| children |
line wrap: on
line source
var net = require('net'); var PHRASE = "hello world"; var write = function(socket) { socket.write(PHRASE, 'utf8'); } for (var i = 0; i < 1000; i++) { (function() { var socket = net.connect(7000, 'localhost', function() { socket.on('data', function(reply) { if (reply.toString().indexOf(PHRASE) != 0) console.error("Problem! '" + reply + "'" + " '" + PHRASE + "'"); else write(socket); }); write(socket); }); })(); }