0

我正在尝试将远程 destop(3389) 代理到端口 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());
});

然后使用win7的远程桌面,访问自己,它失败了。

更新:

remotedestop connect 长时间显示“连接到 127.0.0.1:8889”,然后超时。

在此处输入图像描述

4

2 回答 2

0

您正在覆盖host变量,首先分配'127.0.0.1'并在您 assing 下面的行中'192.168.7.69',也许这就是问题

var host = '127.0.0.1',
    host2 = '192.168.7.69'
于 2012-07-02T09:27:49.850 回答
0

解决了,换个顺序。

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());
  });
});
于 2012-07-03T01:33:50.920 回答