[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

the other node.js example

From the home page of nodejs.org:

Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:

var net = require('net');

var server = net.createServer(function (socket) {
  socket.write('Echo server\r\n');

server.listen(1337, '');

I can run this ...  but how do I sent a message that will be echoed by the server?
Tom Knowlton
Tom Knowlton
1 Solution
Randy PooleCommented:
You can use a telnet client:

telnet 1337

then just type
Tom KnowltonWeb developerAuthor Commented:
It works!!

Is there a way to keep the characters from doing this:

ffoooo bbaarr

I mean - the server is supposed to echo what I type, which it is, but it just looks strange.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now