phpstorm内网远程debug

家里用的是广电的网络,接了无线路由,在192.168.1.1里面配置了端口转发,将9001转发到192.168.1.101 ,然后在php.ini中相应的配置了xdebug, phpstorm 启动监听,结果失望了,我设置的断点没有任何反应,没有得到一丁点的调试信息,在看网络链接,phpstorm确实是在9001监听着,来到服务器tail -f /root/xdebug.log  收到了来自本机的请求,但是返回的信息无法到达,于是断定是我的网络地址有问题,打电话问广电客服,果然是,我们的拨号确实分配了一个独立IP但是,这个IP是在一张局域网中的,因为广电是租用的电信的线路,怎么办?自己写转发吧,听说nodejs做这些工作挺傻瓜化的,不用劳烦 win socket或者linux socket了,当然前提是都装好了nodejs

linux:

var net = require('net');

var util=require('util');

var sock1;

var sock2;

var server = net.createServer(function(c) { //'connection' listener

  sock1=c;

  console.log('client connected');

  console.log('RemoteAddr='+c.remoteAddress);

  console.log('RemotePort='+c.remotePort);

  console.log('------------------------------');

  c.on('end', function() {

    console.log('client disconnected');

  });

  c.on('data',function(data){

    console.log('data received');

      console.log(data);

    console.log('------------------------');

    sock2.write(data);

  });

});

server.listen(8124, function() { //'listening' listener

  console.log('server start');

});





var server9001 = net.createServer(function(c){

  sock2=c;

  c.on('data',function(data){

    console.log('data from '+c.remoteAddress+":"+c.remotePort);

    console.log(data);

    console.log("--------------------------------");

    sock1.write(data);

  });

});

server9001.listen(9001,function(){

  console.log('server9001 start');

});

win7

var net = require('net');



var HOST = '115.28.200.122';

var PORT = 8124;

var phpstorm = new net.Socket();

var proxyClient = new net.Socket();

phpstorm.connect(9001,'localhost',function(){

    console.log("phpstorm connected");

    console.log('--------------------------');

});

proxyClient.connect(PORT, HOST, function() {

    console.log('proxyClient CONNECTED TO: ' + HOST + ':' + PORT);

    console.log('--------------------------');

});



proxyClient.on('data', function(data) {

    console.log("proxyClient data received");

    console.log(data);

    console.log("----------------------------------");

    phpstorm.write(data);

});



proxyClient.on('close', function() {

    console.log('Connection closed');

});



phpstorm.on('data',function(data){

    console.log('phpstorm data received');

    console.log(data);

    console.log("------------------------------");

    proxyClient.write(data);

});

 

你可能感兴趣的:(storm)