Hello!

I'm trying to use com.jcraft.jsch.SocketFactory() to create Socket. I need
to get Socket. I add getSocket() as below:

public class SSHSocketFactory implements com.jcraft.jsch.SocketFactory {

    private SSHSocket gSocket = null;

    public synchronized Socket createSocket(String host, int port) throws
IOException, UnknownHostException {

        gSocket = new SSHSocket(host, port);
        return gSocket;
    }

.....

    public SSHSocket getSocket() {

        return gSocket;
    }
}


If the same socket factory is called multiple times(including by Jsch
internally too), then It always returns the last socket.

I guess I need a method like createSocket(id,host,port) to get it by
getSocket(id).

How can I safely get Socket created by specic host,port pair ?

thanks in advance...




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to