Because, the browser is likely trying to download other things like favicons. Try using `nc`[1] instead to connect to it.
[1] http://linux.die.net/man/1/nc – Micheil On 05/02/2013, at 3:26 AM, Lee David <[email protected]> wrote: > > -------------------- chatServer.js -------------------------- > > var net = require('net'); > > var chatServer = net.createServer(); > > chatServer.on('connection', function(client){ > console.log('A user is connected to server'); > > client.write('Hi!\n'); > client.write('Bye!\n'); > > client.end(); > }); > > chatServer.listen(9000); > console.log('Chat server started\n'); > > > I have written this file and run the node server using this command : node > chatServer.js > > and I opened the browser and join to 127.0.0.1:9000 > > the result that I expected is : > > $ ~: node chatServer.js > Chat server started > > A user is connected to server. > > > but I meet the messages so many > > $ ~: node chatServer.js > Chat server started > > A user is connected to server. > A user is connected to server. > A user is connected to server. > A user is connected to server. > > > Please let me know when you have chance. > > Have a nice day > > Thanks! > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
