You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ Client }=require('ssh2');constconn=newClient();conn.on('ready',()=>{console.log('Client :: ready');conn.forwardIn('127.0.0.1',80,(err)=>{if(err)throwerr;console.log('Listening for connections on server on port 8000!');});}).on('tcp connection',(info,accept,reject)=>{console.log('TCP :: INCOMING CONNECTION:');console.dir(info);accept().on('close',()=>{console.log('TCP :: CLOSED');}).on('data',(data)=>{console.log('TCP :: DATA: '+data);}).end(['HTTP/1.1 404 Not Found','Date: Thu, 15 Nov 2012 02:07:58 GMT','Server: ForwardedConnection','Content-Length: 0','Connection: close','',''].join('\r\n'));}).connect(connectConfig);
When service is listening on the port for example 8080 all is fine( conn.forwardIn('127.0.0.1', 8080, (err) => {}
Below fix the problem, but all makes work around. I will appreciate any hint.
ssh2 doesn't bind any local ports or automatically forward connections for you (e.g. like with OpenSSH's -L and -R forwarding), that is up to you to do. The reason for this is that it gives you the opportunity to handle connections in-process.
When service is listening on the port for example 8080 all is fine( conn.forwardIn('127.0.0.1', 8080, (err) => {}
Below fix the problem, but all makes work around. I will appreciate any hint.
The text was updated successfully, but these errors were encountered: