title: Coldfusion secure cfftp times out
body: <p>I am using Coldfusion 9. I have verified that the sFTP host is valid and I can connect using "CyberDuck". The port is not the standard 21 (ftp) or 22 (ssh)</p>
  
  <pre><code>&lt;cfftp 
      username=   "myysername"
      password=   "mypassword"
      port=       "6589"
      server=     "ftphost.com"
      secure=     "yes"
      name=       "ftpconnection"
      action=     "open" /&gt;
  
  &lt;cfdump var="#ftpconnection#"&gt;
  </code></pre>
  
  <p>The result, after about 1 minute is :</p>
  
  <pre><code>com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
      at com.jcraft.jsch.Session.connect(Unknown Source)
      at com.jcraft.jsch.Session.connect(Unknown Source)
      at coldfusion.tagext.net.SftpHandler.getConnection(SftpHandler.java:265)
      at coldfusion.tagext.net.SftpHandler.createConnection(SftpHandler.java:76)
      at coldfusion.tagext.net.FtpTag.doStartTag(FtpTag.java:675)
      at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722)
  </code></pre>
  
  <p>I have also tried building this connection by calling the JSCH classes ( <a href="http://www.jcraft.com/jsch/examples/Sftp.java.html" rel="nofollow">http://www.jcraft.com/jsch/examples/Sftp.java.html</a> ) manually, but to no avail.</p>
  
  <p>The question is, why is this timing out in code, but not when using a program like CyberDuck ?</p>
  
  <p><strong>EDIT TO ADD CF-Java code</strong></p>
  
  <pre><code>jsch = CreateObject("java", "com.jcraft.jsch.JSch");
  jsession = CreateObject("java", "com.jcraft.jsch.Session");
  jChannel = CreateObject("java", "com.jcraft.jsch.Channel");
  jChannelSFTP = CreateObject("java", "com.jcraft.jsch.ChannelSftp");
  jUserInfo = CreateObject("java", "com.jcraft.jsch.UserInfo");
  jProperties = CreateObject("java", "java.util.Properties");
  jLogger = CreateObject("java", "com.jcraft.jsch.Logger");
  
  host = "ftphost.com";
  username = "myusername";
  portNumber = "6589";
  
  javaCast("String", "host");
  javaCast("String", "username");
  
  /* *********************** */
  jProperties.put("StrictHostKeyChecking", "no");
  jsession = jsch.getSession(username, host, portNumber);
  jsession.setPassword("mypassword");
  jsession.setPort(6589);
  jsession.setUserInfo(jUserInfo);
  jsession.setConfig(jProperties);
  
  writeOutput("Connect ...");
  getPageContext().getOut().flush();
  jsession.connect();
  writeOutput("done &lt;br&gt;");
  </code></pre>
  
  <p>This code doesn't error per se, but the connect() method never "returns"  :</p>
  
  <pre><code>connection is closed by foreign host
  
      The error occurred in /Library/WebServer/Coldfusion/SFTP/index.cfm: line 53
      51 : writeOutput("Connect ...");
      52 : getPageContext().getOut().flush();
      53 : jsession.connect();
      54 : writeOutput("done &lt;br&gt;");
      55 : 
  </code></pre>
  
  <p><strong>EDITED TO SHOW CYBERDUCK CONNECTION LOG</strong></p>
  
  <pre><code>220 Service ready for new user.
  AUTH TLS
  234 Command AUTH okay; starting TLS connection.
  USER myusername
  331 User name okay, need password for myusername.
  PASS ********
  230 User logged in, proceed.
  PBSZ 0
  200 Command PBSZ okay.
  PROT P
  200 Command PROT okay.
  FEAT
  [ ... ]
  
  OPTS UTF8 ON
  200 Command OPTS okay.
  NOOP
  200 Command NOOP okay.
  SYST
  215 UNIX Type: Apache FtpServer
  STAT /root
  200--rw-------   1 SMG TGMS       263375 Nov 25 01:35 afile.txt
  </code></pre>