Package com.jcraft.jsch

Examples of com.jcraft.jsch.ChannelDirectTCPIP


        @Override
        public SshDirectTcpipChannel getDirectTcpipConnection(InetSocketAddress local, InetSocketAddress remote)
                throws IOException {
            Session session = getSession();

            ChannelDirectTCPIP directChannel;
            try {
                directChannel = (ChannelDirectTCPIP) session.openChannel("direct-tcpip");

                directChannel.setHost(InetAddresses.toAddrString(remote.getAddress()));
                directChannel.setPort(remote.getPort());

                directChannel.setOrgIPAddress(InetAddresses.toAddrString(local.getAddress()));
                directChannel.setOrgPort(local.getPort());

                channelCount++;
                directChannel.connect();
            } catch (JSchException e) {
                // TODO: Close session if it's failed??
                channelCount--;
                throw new IOException("Error opening direct-tcpip channel", e);
            }
View Full Code Here


                throws IOException {
            Session session = getSession();

            String bindAddress = InetAddresses.toAddrString(localAddress);
            int assignedPort;
            ChannelDirectTCPIP directChannel;
            try {
                int port = 0; // Auto asssign
                assignedPort = session.setPortForwardingL(bindAddress, port, remoteSocketAddress.getHostString(),
                        remoteSocketAddress.getPort());
View Full Code Here

TOP

Related Classes of com.jcraft.jsch.ChannelDirectTCPIP

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.