private void setPortForwarding(int rport)
{
lock(grr)
{
Buffer buf=new Buffer(100); // ??
Packet packet=new Packet(buf);
try
{
// byte SSH_MSG_GLOBAL_REQUEST 80
// String "tcpip-forward"
// bool want_reply
// String address_to_bind
// uint32 port number to bind
packet.reset();
buf.WriteByte((byte) SSH_MSG_GLOBAL_REQUEST);
buf.WriteString( "tcpip-forward" );
// buf.putByte((byte)0);
buf.WriteByte((byte)1);
buf.WriteString("0.0.0.0");
buf.WriteInt(rport);
write(packet);
}
catch(Exception e)
{
throw new JSchException(e.ToString());
}
grr.setThread(System.Threading.Thread.CurrentThread);
try { System.Threading.Thread.Sleep(10000); }
catch(Exception)
{
}
int reply=grr.getReply();
grr.setThread(null);
if(reply==0)
{
throw new JSchException("remote port forwarding failed for listen port "+rport);
}
}
}
public void delPortForwardingR(int rport)