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

x
  • 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');
  socket.pipe(socket);
});

server.listen(1337, '127.0.0.1');


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

telnet 127.0.0.1 1337

then just type
0
 
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.
0

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