I'm following the tutorial on this tutorial. Here's the code:
var net = require('net')
var chatServer = net.createServer()
chatServer.on('connection', function(client) {
client.write('Hi!\n');
client.write('Bye!\n');
console.log("got msg from http"); //added
client.end()
})
chatServer.listen(9000)
I placed a console.log
between the bye
and the client.end()
When I run it and hit port 9000, the console.log
is outputed twice instead of once.
got msg from http
got msg from http
anyone know why?
Thanks