Mercurial
annotate third_party/libuv/docs/code/multi-echo-server/hammer.js @ 270:358dd5950985
sync production config on every deploy
Always install the ignored repository .config into /etc/mrjunejune before promoting the new bundle.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:16:47 -0700 |
| parents | 948de3f54cea |
| children |
| rev | line source |
|---|---|
| 160 | 1 var net = require('net'); |
| 2 | |
| 3 var PHRASE = "hello world"; | |
| 4 var write = function(socket) { | |
| 5 socket.write(PHRASE, 'utf8'); | |
| 6 } | |
| 7 | |
| 8 for (var i = 0; i < 1000; i++) { | |
| 9 (function() { | |
| 10 var socket = net.connect(7000, 'localhost', function() { | |
| 11 socket.on('data', function(reply) { | |
| 12 if (reply.toString().indexOf(PHRASE) != 0) | |
| 13 console.error("Problem! '" + reply + "'" + " '" + PHRASE + "'"); | |
| 14 else | |
| 15 write(socket); | |
| 16 }); | |
| 17 write(socket); | |
| 18 }); | |
| 19 })(); | |
| 20 } |