Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

try to proxy remote destop(3389) by nodejs socket pipe, but fail

try to proxy remote destop(3389) by nodejs socket pipe, but fail

Problem

I'm trying to proxy remote destop(3389) to port 8889.

var net = require('net');
var client_port = 8889;
var host = '127.0.0.1';
host = '192.168.7.69'; 

var client = net.createServer(function(c) {
    var loc = net.connect(3389, host, function() {
      console.log('connet to 3389 success.');
      loc.pipe(c);
      c.pipe(loc);
    });
}).listen(client_port, host, function(c) {
  console.log('proxy opened, visit: %j',client.address());
});

then use win7's remote destop, visit myself, it fail.

update:

the remotedestop connect show "connet to 127.0.0.1:8889" for a long time, and timeout.

Problem courtesy of: atian25

Solution

solved, change the order.

var net = require('net');
var client_port = 8889;
var host = '127.0.0.1';
host = '192.168.7.69'; 

var client;
var loc = net.connect(3389, host, function() {
  console.log('connet to 3389 success.');
  client = net.createServer(function(c) {
    loc.pipe(c);
    c.pipe(loc);
  }).listen(client_port, host, function(c) {
    console.log('proxy opened, visit: %j',client.address());
  });
});
Solution courtesy of: atian25

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

try to proxy remote destop(3389) by nodejs socket pipe, but fail

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×