W
W
winolog2011-12-16 12:47:00
Node.js
winolog, 2011-12-16 12:47:00

NodeJS

Hello.
Is it possible to connect from the server side to another server on a TCP port using nodeJS and receive data?
Regards winolog.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
winolog, 2011-12-16
@winolog

net = require("net");
varstream = new net.Stream();
stream.connect(80,'ya.ru')
stream.setEncoding('utf8')
stream.addListener('connect', function () {
stream.write("a");
});
stream.addListener('data', function (s) {
console.log(s);
});
stream.addListener('end', function () {
stream.connect(80,'ya.ru');
});

W
winolog, 2011-12-16
@winolog

It's interesting sometimes to talk to a smart person. I asked myself, I answered myself ... =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question