Sorry, if this mail appears multiple times.
I sent it twice already, but it did not appear on the list.
Disabled s/mime signature this this...
Hi
I need to forward (a lot of) ports over SSH connections. Similar to usual
ssh -L a:b:c commands.
Now, I want to open the ssh connections only when they are used. I
implemented a java nio framework to accept incoming connections using a
single thread.
That part works.
As soon as I need the ssh connectons, I build them as required. This part
also works.
Then I need to connect that (locally already accepted) tcp connections over
the ssh connections. That part does not work. I try it this way:
System.out.println( "Connecting " + bindHost + ":" + bindPort + " ->
" + targetHost + ":" + targetPort );
socket.setTcpNoDelay( true );
Channel channel = session.openChannel( "direct-tcpip" );
( (ChannelDirectTCPIP) channel ).setInputStream(
socket.getInputStream() );
( (ChannelDirectTCPIP) channel ).setOutputStream(
socket.getOutputStream() );
( (ChannelDirectTCPIP) channel ).setHost( targetHost );
( (ChannelDirectTCPIP) channel ).setPort( targetPort );
( (ChannelDirectTCPIP) channel ).setOrgIPAddress(
socket.getInetAddress().getHostAddress() );
( (ChannelDirectTCPIP) channel ).setOrgPort( socket.getPort() );
try {
channel.connect();
} catch ( Throwable t ) {
t.printStackTrace();
}
However, connections just stall.
Can anyone give me a hint, what I am doing wrong?
Do I need to add a thread to forward information? (I thought direct-tcpip
would do that for me....
Any hints are welcome.
Best regards,
Steffen
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users