Ftp Client Example

Anybody interested in playing with my tool implementation of a ftp client
in forte feel free to email me, and I will send you it. I had tried to
post it to the user group, but it exceeded the size limitations (40000).
Could those of you who emailed me already please do so again. I deleted
your emails in anticipation of being able to post it to the user group.
Thank you,
Chris Henson
ATG Solutions Inc.
[email protected]
[email protected] (mail me here)
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

Hi,
Well, it appears that the 40 bit trial version of the
FTP server software was part of the problem. After I
found a trial FTP server version that had 128 bit
encrytpion, it no longer hung. However, I still get
an "Unknown SSL message, plaintext connection?" error
after I call startHandshake() after the "AUTH TLS-P"
or "AUTH SSL" command. However, setting the server
for implicit ssl and creating the ssl socket from the
beginning works just fine. Do secure sockets not work
with explicit SSL? Anyone have any ideas?
Thanks!
Anna I exactly get the same problem. In inmplicit SSL mode, eveything works just fine. But when I configure the server in explicit SSL mode, and thta my client is developped to create such connections, it doesn't work nad i get the same error message: "Unknown SSL message, plaintext connection?". Have you worked out this problem ???
I'm waiting for your answer

Similar Messages

  • FTP client problem

    Hello.
    I'm trying to create a ftp client running on adobe AIR in flex builder.
    The fcommand socket work, but when i create the data socket, the command socket still work but if I tipe a new command, like PWD, i do not receive answer. Does someone know why?
    I don't see error events widh IO_ERROR or SECURITY error, so I suppose no error occours.
    here is the code
    import flash.events.Event;
                   import flash.events.IOErrorEvent;
                   import flash.events.MouseEvent;
                   import flash.events.ProgressEvent;
                   import flash.events.SecurityErrorEvent;
                   import flash.net.Socket;
                   protected var s:Socket;               // socket comandi
                   protected var s_dati:Socket;
                   protected function btn_connetti_clickHandler(event:MouseEvent):void
                        var aspetta:Boolean = true;
                        function connesso(evt:Event):void     {
                             //label_stato.text += "Connesso!";
                             // ora che la socket è connessa invia user e password
                             s.writeUTFBytes("USER **\n");
                             s.writeUTFBytes("PASS **\n");
                             // apre un canale dati passivo
                             //s.writeUTFBytes("RETR index.php\n");
                             s.writeUTFBytes("PASV\n");
                        function connessoDati(evt:Event):void     {
                             label_stato.text += "Socket dati connessa!";
                             if(s.connected)
                                  s.writeUTFBytes("\nLIST\n\n");     THIS COMMAND DOES NOT RETURN ANY OUTPUT
                             else
                                  label_stato.text = "CONNESSIONE PERSA\n";
                        function riceviDati(evt:ProgressEvent):void     {
                             label_stato.text += "DATA -> "+ s_dati.readUTFBytes(evt.bytesLoaded);
                        function erroreSicurezza(evt:SecurityErrorEvent):void     {
                             label_stato.text = "Errore nella sicurezza "+evt.text;
                        function chudi(evt:Event):void     {
                             label_stato.text = "Chiusura connessione";
                        function progresso(evt:ProgressEvent):void     {
                             var str:String = s.readUTFBytes(evt.bytesLoaded);
                             label_stato.text += str;
                             var arrS:Array = str.split("\n");
                             for (var i:int = 0; i<arrS.length; i++)     {
                                  //if(arrS[i])
                                  //label_stato.text += "->"+arrS[i]+"\n";
                                  var tmps:String = arrS[i].toString();
                                  if(tmps.substr(0,3) == "227")     {
                                       //label_stato.text += tmps+"\n";
                                       var IPport:String = tmps.substring( tmps.indexOf("("), tmps.indexOf(")") );
                                       var numeri:Array = IPport.split(",");
                                       var porta:Number = 0;     // numero di porta;
                                       var LSB:Number = numeri[numeri.length-1];
                                       var MSB:Number = numeri[numeri.length-2];
                                       label_stato.text += "Connessione passiva\n" + MSB+ " " + LSB+"\n";
                                       porta = (MSB *256) + LSB;
                                       s_dati.connect("ftp.******.it", porta);
                                       s.writeUTFBytes("RETR index.php\n");
                        function erroreIO(evt:IOErrorEvent):void     {
                             label_stato.text += "\nERRORE " + evt.text;
                        // crea la socket
                        s = new Socket();
                        s_dati = new Socket();
                        // gestione eventi
                        s.addEventListener(Event.CONNECT, connesso);
                        s.addEventListener(ProgressEvent.SOCKET_DATA, progresso);
                        s.addEventListener(IOErrorEvent.IO_ERROR, erroreIO);
                        s.addEventListener(SecurityErrorEvent.SECURITY_ERROR, erroreSicurezza);
                        s.addEventListener(Event.CLOSE, chudi);
                        s_dati.addEventListener(Event.CONNECT, connessoDati);
                        s_dati.addEventListener(ProgressEvent.SOCKET_DATA, riceviDati);
                        s_dati.addEventListener(IOErrorEvent.IO_ERROR, erroreIO);
                        s_dati.addEventListener(SecurityErrorEvent.SECURITY_ERROR, erroreSicurezza);
                        s_dati.addEventListener(Event.CLOSE, chudi);
                        s.connect("ftp.****.it", 21);
                   protected function btn_dati_clickHandler(event:MouseEvent):void
                        label_stato.text += tx_comandi.text+"\n";
                        s.writeUTFBytes(tx_comandi+"\n");

    Hi,
    I'm having the same problem, I fight with this for last week and nothing, I cant find a working example of socket connection on the internet, local work ok, but on server i get one of all of this errors all time:
    SecurityError–>Error #2048,
    *** Security Sandbox Violation ***,
    Warning: [strict] Ignoring policy file at xmlsocket://xxxxxxx.com:21 due to incorrect syntax.  See http://www.adobe.com/go/strict_policy_files to fix this problem.
    I read and try all adobe answers for the problem: Security.loadPolicyFile; crossdomain.xml...
    Updates, others webrowsers...
    I check all webpages about this problem and nothing.
    Follow some lines I try for last week:
    Security.loadPolicyFile("http://www.xxxxx.com:80");    or
    Security.loadPolicyFile("http://www.xxxxx.com/crossdomain.xml");
    s = new Socket("xxxxx.com",21)
    s = new Socket("ftp.xxxxx.com",21)  <<< this one dont work even local
    It worked fine from my local machine. But when I deployed it on my server...
    Is this some kind of bug?
    Anyone know a working example that i can check?

  • WRT54G2 and ftp client

    Hello there!
    Find strange problem working with WRT54G2 (firmware 1.0.04 - latest) 
    I try to connect to ftp server and very often get disconnects - see example of log below:
    2009-09-20 23:37:50 3292 0 Status DNS request *******
    2009-09-20 23:37:50 3292 0 Status Connection with *********
    2009-09-20 23:37:50 3292 0 Status Connection established
    2009-09-20 23:37:51 3292 0 Reply: 220 Welcome to Hosting Telesystems ftp service.
    2009-09-20 23:37:51 3292 0 Command: USER ********
    2009-09-20 23:37:51 3292 0 Reply: 331 Please specify the password.
    2009-09-20 23:37:51 3292 0 Command: PASS ********
    2009-09-20 23:37:51 3292 0 Reply: 230 Login successful.
    2009-09-20 23:37:51 3292 0 Command: SYST
    2009-09-20 23:37:51 3292 0 Reply: 215 UNIX Type: L8
    2009-09-20 23:37:51 3292 0 Command: FEAT
    2009-09-20 23:37:51 3292 0 Reply: 211-Features:
    2009-09-20 23:37:51 3292 0 Reply: EPRT
    2009-09-20 23:37:51 3292 0 Reply: EPSV
    2009-09-20 23:37:51 3292 0 Reply: MDTM
    2009-09-20 23:37:51 3292 0 Reply: PASV
    2009-09-20 23:37:51 3292 0 Reply: REST STREAM
    2009-09-20 23:37:51 3292 0 Reply: SIZE
    2009-09-20 23:37:51 3292 0 Reply: TVFS
    2009-09-20 23:37:51 3292 0 Reply: UTF8
    2009-09-20 23:37:51 3292 0 Reply: 211 End
    2009-09-20 23:37:51 3292 0 Command: OPTS UTF8 ON
    2009-09-20 23:37:51 3292 0 Reply: 200 Always in UTF8 mode.
    2009-09-20 23:37:51 3292 0 Status Connection established
    2009-09-20 23:37:51 3292 0 Status getting list of directories
    2009-09-20 23:37:51 3292 0 Command: PWD
    2009-09-20 23:37:51 3292 0 Reply: 257 "/"
    2009-09-20 23:37:51 3292 0 Command: TYPE I
    2009-09-20 23:37:51 3292 0 Reply: 200 Switching to Binary mode.
    2009-09-20 23:37:51 3292 0 Command: PASV
    2009-09-20 23:37:54 3292 0 Ошибка:  ECONNABORTED - Connection aborted 
    Same for all ftp servers i'm trying to access (even with ftp-server of my provider just next hop from router). Also i tried different ftp clients. Tracert doesn't indicate any troubles on the way.
    But most interesting that after several tries it's connecting successfully. And after 10-20 tries i could even upload/download file to server. So it does not completely blocked somewhere, it works but very not stable.
    I tried same client with Linksys WAG54GS (DSL modem) just to check could it be problem with my laptop and it works very good, no problems at all. 
    Looks like my WRT54G2 doesn't work very well with ftp. May be NAT problem or something else? Any ideas how this could be fixed?
    Many thanks in advance,
    mitko

    Well, try to reflash the firmware for the router and forward the port 21 on the router for ip address of computer on which you are trying to access the FTP.

  • Redirecting get command inside ftp client?

    Is it possible to redirect get command inside ftp client?
    I was only able to do "get filename /dev/null" to redirect it to /dev/null.. However.. what if I want to redirect it to a compression or decompression utility?
    Example of ftp script I used:
    #!/bin/bash
    HOST='server-ip'
    USER='username'
    PASSWD='password'
    FILE=$1
    ftp -i -n $HOST <<END_SCRIPT
    user ${USER} ${PASSWD}
    binary
    get $FILE
    quit
    END_SCRIPT
    exit 0
    The file I am trying to get is a compressed file, I would like to pipe it into decompression utility like gunzip.
    Last edited by kdar (2012-09-03 19:33:52)

    Solved it. I found that I could access ftp server with wget as well, and redirect it's output to another utility:
    time wget --user=username --password=password -qO - ftp://serverName/file.gz | gunzip -cf > /dev/null
    Last edited by kdar (2012-09-03 21:32:47)

  • Is there  way to support FTP client using Servlet API in Tomcat/JBoss.

    Hi Friends,
    I am working in a web based project developed by Servlet.I am using JBoss App Server to handle the web request by http clients. But i need to handle the FTP client also now.So please guide me.
    How can i setup (coding) to handle FTP client request?.
    What should i change on the server setting?.
    I would be very happy if there is a good examples
    Thanks in Advance.
    P.Saravanan

    This will allow you to programmatically pair with a bluetooth device.
    You will also have to download the dotnet files from 32feet
    http://32feet.net/files/
    -Regards
    eximo
    UofL Bioengineering M.S.
    Neuronetrix
    "I had rather be right than be president" -Henry Clay
    Attachments:
    Bluetooth discover and Pair.vi ‏51 KB

  • Getting pictures on a FTP client.

    If I only want to get seven pictures on a FTP client, is it really necessary to have a web site. Are there any other possibilities?

    jonesan wrote:
    Thanks again. After using your directions for connecting to the site, as in nr.8, I got  FTP information, to open a TCP/IP connection. How do I do that? In the FTP program I have filled out for host: ftpmysite.verizon.net.  For profile name I used WS_FTP32, is that correct?
    Yes that is correct.
    Here is an example of the correct settings for Core FTP LE.
    http://i45.tinypic.com/mmefxv.jpg
    Note: Do not use the user name anonymous (by having anonymous checked ) , use your real verizon user name.
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • HOw to connect FTP Client using flex

        Hi Everyone,
                   i am new to flex, i am developing one flex application, some one give example of connecting ftp client using flex. i didnot found any examples.
    thnx

    You would need to communicate with your ftp server over a socket and implement the ftp protocol on your client. The project below aims to do this, but I have never used it:
    http://maliboo.riaforge.org/
    Why not download over http (and save yourself a lot of time)?

  • Using FTP clients to publish to iWeb

    I understand fully that:
    http://web.mac.com/YourMemberName/iWeb/SiteName
    is the url for my iWeb site.
    My question is how does that translate into the typical required login information of ordinary FTP clients such as Cyberduck?
    I have tried many combinations of server names, user names, paths, passwords and NOTHING will get me logged into my iWeb site with an FTP client.
    The "Publish" button in iWeb works fine, but for various reasons, I would like to access the site with an ordinary FTP client.
    Thanks in advance for any help with this. I am a newbie to Mac and OS X, but have 20 years of serious experience with the MS juggernaut
    windowsrefugee

    Like Tom mentioned, your iWeb site actually resides on your iDisk...and transfers to and from your iDisk are accomplished through the webDAV protocol instead of FTP. Goliath is a webDAV client. You can also accomplish an "upload" to your iDisk just by mounting your iDisk to your desktop (Apple-Shift-i) and then dragging and dropping whatever you want to transfer. Windows also supports webDAV, so the dragging and dropping transfers will work there, too, after you mount your iDisk as a network drive.
    In terms of the URLs to use, the basic URL for your iDisk is as follows:
    http://idisk.mac.com/username
    This and any other iDisk URL should prompt for your .Mac username and password.
    You can also specify exactly which folder you want to access by appending the appropriate foldername to the end of the basic URL.
    As far as how all this fits with iWeb, consider the following example...
    http://web.mac.com/username is quasi-equivalent to http://idisk.mac.com/username/Web/Sites/index.html
    ...Except that it would prompt you for your .Mac username and password. This would be an interesting and alternative way to password protect your site if you wanted to do it with your .Mac user/pass.

  • Issue with Ftp Client / Server using Sockets

    I have developed a Ftp Client and a Ftp Server. The client Connects to the Ftp Server and sends files to the ftp server. It is a multi threaded server and can have multiple clients connecting to it.
    If a client goes down...the server waits till the client comes up
    Similarly the client waits if a server goes down and reconnects when the server is again up and running
    i am having a strange issue here. When two clients go down and reconnect to the server...They take a long time to connect and transferring of files takes a long time...
    Other wise in all other scenarios the duo work properly.
    Any feedback and suggestion about this strange issue from all you java gurus out there will be deeply appreciated.
    Here is the client code
    import java.net.*;
    import java.net.Socket;
    import java.net.InetAddress;
    import java.io.*;
    import java.io.File;
    import java.util.*;
    import java.lang.*;
    import java.lang.Object;
    import javax.crypto.*;
    import java.util.regex.*;
    import javax.crypto.spec.PBEKeySpec;
    import javax.crypto.spec.PBEParameterSpec;
    import java.security.spec.AlgorithmParameterSpec;
    import java.security.spec.KeySpec;
    import java.io.InputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.File.*;
    import java.nio.channels.FileLock;
    public class  FTPClient {
         public static void main(String[] args) throws Exception
              Timer timer = new Timer("Test Timer");
              timer.scheduleAtFixedRate(new TimerTask()
                   private int counter = 0;
                                            public void run() {
                                                                     try     {                                                                                
                                                                              System.out.println(counter++);
                                                                               Socket soc=new Socket("xxx.x.x.xx",5217);
                                                                               System.out.println("Socket Initialised.");          
                                                                               transferfileClient t=new transferfileClient(soc);
                                                                               t.SendFile();
                                                                               System.out.println("run complete.");                                                                           
                                                                          catch(Exception ex)
                                                           }, 10000, 40000);
         static class transferfileClient
         Socket ClientSoc;
         DataInputStream din;
         DataOutputStream dout;
         BufferedReader br;
         transferfileClient(Socket soc)
              try
                   ClientSoc=soc;
                   din=new DataInputStream(ClientSoc.getInputStream());
                   dout=new DataOutputStream(ClientSoc.getOutputStream());
                   br=new BufferedReader(new InputStreamReader(System.in));
              catch(Exception ex)
         //encrypto routine starts
    class DesEncrypter {
           Cipher ecipher;
            Cipher dcipher;   
            // 8-byte Salt
            byte[] salt = {
                (byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
                (byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03
            // Iteration count
            int iterationCount = 19;   
            DesEncrypter(String passPhrase) {
                try {
                             // Create the key
                             KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
                             SecretKey key = SecretKeyFactory.getInstance(
                             "PBEWithMD5AndDES").generateSecret(keySpec);
                             ecipher = Cipher.getInstance(key.getAlgorithm());
                             dcipher = Cipher.getInstance(key.getAlgorithm());   
                             // Prepare the parameter to the ciphers
                             AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);   
                             // Create the ciphers
                             ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
                             dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
                } catch (java.security.InvalidAlgorithmParameterException e) {
                } catch (java.security.spec.InvalidKeySpecException e) {
                } catch (javax.crypto.NoSuchPaddingException e) {
                } catch (java.security.NoSuchAlgorithmException e) {
                } catch (java.security.InvalidKeyException e) {
            // Buffer used to transport the bytes from one stream to another
            byte[] buf = new byte[1024];   
            public void encrypt(InputStream in, OutputStream out) {
                try {
                    // Bytes written to out will be encrypted
                    out = new CipherOutputStream(out, ecipher);   
                    // Read in the cleartext bytes and write to out to encrypt
                    int numRead = 0;
                    while ((numRead = in.read(buf)) >= 0) {
                        out.write(buf, 0, numRead);
                    out.close();
                } catch (java.io.IOException e) {
            public void decrypt(InputStream in, OutputStream out) {
                try {
                    // Bytes read from in will be decrypted
                    in = new CipherInputStream(in, dcipher);   
                    // Read in the decrypted bytes and write the cleartext to out
                    int numRead = 0;
                    while ((numRead = in.read(buf)) >= 0) {
                        out.write(buf, 0, numRead);
                    out.close();
                } catch (java.io.IOException e) {
    }     //encryptor routine ends     
         void SendFile() throws Exception
                   try
                   String directoryName; 
                   // File object referring to the directory.
                   String[] files;        // Array of file names in the directory.        
                   //directory = new File ( "C:\\FTP\\" ) ; 
                   File directory1 = new File("C:\\FTP");
                        boolean successmk = directory1.mkdir();
                        if (!successmk) {
                             // Directory creation failed /Already Exists
                        File directory = new File("C:\\FTP\\ftpc");
                        boolean successmk1 = directory.mkdir();
                        if (!successmk1) {
                             // Directory creation failed /Already Exists
                   //directory = new File ( "E:\\FTP-encrypted" ) ;           
                if (directory.isDirectory() == false) {
                    if (directory.exists() == false)
                       System.out.println("There is no such directory!");
                    else
                      System.out.println("That file is not a directory.");
                else {
                    files = directory.list();
                    System.out.println("Files in directory \"" + directory + "\":");
                    for (int i = 0; i < files.length; i++)
                             String patternStr = "xml";
                             Pattern pattern = Pattern.compile(patternStr);
                             Matcher matcher = pattern.matcher(files);
                             boolean matchFound = matcher.find();
                                       if (matchFound) {                                   
                                       System.out.println(" " + files[i]);                                        
                                       String filename;
                                       filename=files[i];                                   
                                       File f=new File(directory,filename);
                                       FileLock lock = null;                                   
                                       FileOutputStream fos = new FileOutputStream(f, true);
                                       lock = fos.getChannel().tryLock();
                                                 if (lock == null) {
                                                 System.out.println(" Failed to get the file lock: means that the file is locked by other instance.");
                                                 fos.close();
                                                 else
                                                                     InetAddress addr = InetAddress.getLocalHost();                                                                      
                                                                               // Get IP Address
                                                                               //byte[] ipAddr = addr.getAddress();
                                                                               String ip= addr.toString();                                                                      
                                                                               // Get hostname
                                                                               //String hostname = addr.getHostName();
                                       System.out.println(" Lock Acquired.");
                                       lock.release();
                                       fos.close();
                                       dout.writeUTF("SEND");
                                            dout.writeUTF(ip);
                                       dout.writeUTF(filename);
              //String msgFromServer=din.readUTF();          
    DesEncrypter encrypter = new DesEncrypter("My Pass Phrase!");
    // Encrypt
              FileInputStream fino=new FileInputStream(f);
              encrypter.encrypt(fino,
    new FileOutputStream("ciphertext.txt"));               
              fino.close();
              FileInputStream fin=new FileInputStream("ciphertext.txt");          
              int ch;
              do
                   ch=fin.read();
                   dout.writeUTF(String.valueOf(ch));
              while(ch!=-1);
              fin.close();          
              String option;
                        option=din.readUTF();
                             if((option.compareTo("Delete")==0))     
                                  boolean success = (new File("ciphertext.txt")).delete();
                                  boolean success1 = f.delete();
                                  if (success) {
                                  System.out.println("File Sent ...");
                                  if (success1) {
                                  System.out.println("--File deleted from Client ...");
         for (int j = 0; j < 999999999; j++){}
                                       }//pattermatch loop ends here
    else
                             { //System.out.println("   " + "Not an XML file-------->" +files[i]);
    for (int jb = 0; jb < 111999999; jb++){}
              }// for loop ends here for files in directory
                   }//else loop ends for directory files listing               
         System.out.println("sendfile finished...");
         return;
         }               catch(Exception ex)          {ex.printStackTrace();}                    
         }//sendfile ends here     
         public void displayMenu() throws Exception
                   System.out.println(" Send File");                    
                        SendFile();
                        return;          
    And here is the server code...
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.util.Date;
    import java.text.SimpleDateFormat;
    import java.text.DateFormat;
    import java.text.Format;
    import java.lang.Object;
    import java.lang.*;
    import javax.crypto.*;
    import javax.crypto.spec.PBEKeySpec;
    import javax.crypto.spec.PBEParameterSpec;
    import java.security.spec.AlgorithmParameterSpec;
    import java.security.spec.KeySpec;
    public class FTPServer
    {     public static void main(String args[]) throws Exception
         {     ServerSocket soc=new ServerSocket(5217);
              System.out.println("FTP Server Started on Port Number 5217");
              while(true)
                   System.out.println("Waiting for Connection ...");
                   transferfile t=new transferfile(soc.accept());               
    class transferfile extends Thread
         Socket ClientSoc;
         DataInputStream din;
         DataOutputStream dout;     
         transferfile(Socket soc)
         {     try
              {     ClientSoc=soc;                              
                   din=new DataInputStream(ClientSoc.getInputStream());
                   dout=new DataOutputStream(ClientSoc.getOutputStream());
                   System.out.println("FTP Client Connected ...");
                   System.out.println("External IP of Client ..." + ClientSoc.getInetAddress());
                   //System.out.println("FTP Client Connected ..." + ClientSoc.getRemoteSocketAddress());
                   start();               
              catch(Exception ex)
    //encrypto routine starts
    class DesEncrypter {
            Cipher ecipher;
            Cipher dcipher;   
            // 8-byte Salt
            byte[] salt = {
                (byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
                (byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03 };   
            // Iteration count
            int iterationCount = 19;   
           DesEncrypter(String passPhrase) {
                try {
                    // Create the key
                    KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
                    SecretKey key = SecretKeyFactory.getInstance(
                        "PBEWithMD5AndDES").generateSecret(keySpec);
                    ecipher = Cipher.getInstance(key.getAlgorithm());
                    dcipher = Cipher.getInstance(key.getAlgorithm());   
                    // Prepare the parameter to the ciphers
                    AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);   
                    // Create the ciphers
                    ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
                    dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
                } catch (java.security.InvalidAlgorithmParameterException e) {
                } catch (java.security.spec.InvalidKeySpecException e) {
                } catch (javax.crypto.NoSuchPaddingException e) {
                } catch (java.security.NoSuchAlgorithmException e) {
                } catch (java.security.InvalidKeyException e) {
            // Buffer used to transport the bytes from one stream to another
            byte[] buf = new byte[1024];   
            public void encrypt(InputStream in, OutputStream out) {
                try {
                    // Bytes written to out will be encrypted
                    out = new CipherOutputStream(out, ecipher);   
                    // Read in the cleartext bytes and write to out to encrypt
                    int numRead = 0;
                    while ((numRead = in.read(buf)) >= 0) {
                        out.write(buf, 0, numRead);
                    out.close();
                } catch (java.io.IOException e) {
            public void decrypt(InputStream in, OutputStream out) {
                try {
                    // Bytes read from in will be decrypted
                    in = new CipherInputStream(in, dcipher);   
                    // Read in the decrypted bytes and write the cleartext to out
                    int numRead = 0;
                    while ((numRead = in.read(buf)) >= 0) {
                        out.write(buf, 0, numRead);
                        //added later on
                        in.close();                    
                    out.close();
                } catch (java.io.IOException e) {
    }     //encryptor routine ends
    //not implemented right now as we arent using the ftp server to download stuff...can be activated later on if we want
         void SendFile() throws Exception
              String filename=din.readUTF();
              File f=new File(filename);
              if(!f.exists())
                   dout.writeUTF("File Not Found");
                   return;
              else
              {     dout.writeUTF("READY");
                   FileInputStream fin=new FileInputStream(f);
                   int ch;
                   do
                        ch=fin.read();
                        dout.writeUTF(String.valueOf(ch));
                   while(ch!=-1);     
                   fin.close();     
                   dout.writeUTF("File Received Successfully");                                   
         String Compare(String filename) throws Exception
                        ///dout.writeUTF("entering compare");
                        String dateTempString=new String();
                        Date dateValue=new Date();
                        SimpleDateFormat formatter = new SimpleDateFormat ("hhmmss");
                        dateTempString = formatter.format(dateValue);
                        File dir1 = new File("C:\\FTPnew");
                        boolean success2 = dir1.mkdir();
                        if (!success2) {
                             // Directory creation failed /Already Exists
                        File dir = new File("C:\\FTPnew\\server");
                        boolean success = dir.mkdir();
                        if (!success) {
                             // Directory creation failed /Already Exists
                        File ftemp=new File(dir,dateTempString + filename);
                        File fnewtemp=new File(dir,"new-enc-"+filename);
                        // Create encrypter/decrypter class
                        DesEncrypter encrypter = new DesEncrypter("My Pass Phrase!");
                        FileOutputStream fout=new FileOutputStream(fnewtemp);     
                        int ch;
                        String temp;
                        do
                        {     temp=din.readUTF();
                             ch=Integer.parseInt(temp);
                             if(ch!=-1)
                                  fout.write(ch);                         
                        }while(ch!=-1);
                        fout.close();
                        //dout.writeUTF("written temp en file");
                        // Decrypt
                    encrypter.decrypt(new FileInputStream(fnewtemp),
                    new FileOutputStream(ftemp));
                        //String Option;
                        dout.writeUTF("Delete");                    
                        System.out.println("File Upload Successfull--Duplicate file with timestamp Created");          
                        boolean success1 = fnewtemp.delete();                    
                        return "hello" ;
         void ReceiveFile() throws Exception
              String ip=din.readUTF();
              System.out.println("\tRequest Coming from Internal IP Address : "+ ip);
              String filename=din.readUTF();
              if(filename.compareTo("File not found")==0)
                   return;
              // Destination directory
       File dir11 = new File("C:\\FTPnew");
                        boolean success22 = dir11.mkdir();
                        if (!success22) {
                             // Directory creation failed /Already Exists
                        File dir = new File("C:\\FTPnew\\server");
                        boolean success21 = dir.mkdir();
                        if (!success21) {
                             // Directory creation failed /Already Exists
              File f=new File(dir ,"enc-"+filename);
              File fe=new File(dir,filename);
              String option;
              if(fe.exists())
                   //dout.writeUTF("File Already Exists");
                   String compvalue = Compare(filename);
                   //dout.writeUTF(compvalue);
                   if(compvalue.compareTo("hello")==0)
                        //dout.writeUTF("Transfer Completed");
                        return;
                   option=din.readUTF();
              else
                   //dout.writeUTF("SendFile");
                    option="Y";
                   if(option.compareTo("Y")==0)
                        // Generate a temporary key.       
            // Create encrypter/decrypter class
             DesEncrypter encrypter = new DesEncrypter("My Pass Phrase!");
                 FileOutputStream fout=new FileOutputStream(f);                    
                        int ch;
                        String temp;
                        do
                        {     temp=din.readUTF();
                             ch=Integer.parseInt(temp);
                             if(ch!=-1)
                                  fout.write(ch);                         
                        }while(ch!=-1);
                        fout.close();                    
                        // Decrypt
                    encrypter.decrypt(new FileInputStream(f),
                    new FileOutputStream(fe));          
                        boolean success2 = f.delete();
                        dout.writeUTF("Delete");
                        System.out.println("File Upload Successfull");                    
                   else
                        return;
         public void run()
              while(true)
                   try
                   String Command=din.readUTF();
                   if(Command.compareTo("SEND")==0)
                        System.out.println("\tSEND Command Received ...");     
                        ReceiveFile();
                        continue;
                   catch(Exception ex)
                        //System.out.println("\tClient Terminated Abnormally ...........");
                        continue;

    Please note that this is not an FTP client and server. FTP is defined by a standard IETF protocol and this isn't it.
    Then, move the following lines:
    din=new DataInputStream(ClientSoc.getInputStream());
    dout=new DataOutputStream(ClientSoc.getOutputStream());
    System.out.println("FTP Client Connected ...");
    System.out.println("External IP of Client ..." + ClientSoc.getInetAddress());
    //System.out.println("FTP Client Connected ..."+ClientSoc.getRemoteSocketAddress());from the constructor into the run() method. i.e. don't do anything with the socket in the thread which handles the accept().

  • FTP client is not working in active mode

    Hi,
    I have a ftp issue trying to download iweb files.
    My provider enabled me a ftp access.
    I tried to connect to it with transmit or rbrowser ftp client (passive mode disabled). The connection works well but i can not retrieve the list of files.
    However using my PC and filezilla ftp client in active mode, the connection did work properly.
    Any idea to help make this connection work on my mac ?
    Thanks

    Perhaps this will help...
    http://slacksite.com/other/ftp.html
    "The main problem with active mode FTP actually falls on the client side. The FTP client doesn't make the actual connection to the data port of the server--it simply tells the server what port it is listening on and the server connects back to the specified port on the client. From the client side firewall this appears to be an outside system initiating a connection to an internal client--something that is usually blocked."

  • How can FTP users access my NAS system via FTP client?

    I recently purchased a 2 bay, 4TB Buffalo Link Station DUO in order to solve some FTP issues.  I have about 50 users outside my LAN that need to connect drop files on my NAS, however nobody seems able to connect via FTP client.  If they login using the Web Access Dynamic DNS address they can read and write via their web browser, but it's clunky and slow.
    My NAS system has been given the IP adress of 192.168.1.254 which seem to me that it's a local IP adress, not a public/static IP. Do I need to manually assign an IP adress to my NAS system in order fot users to log into that specific IP and go directly to the shared folders on the NAS system?
    Thanks in advance!

    Your NAS is getting that IP because it is behind your Router, which is the normal way to use it and as it should be.
    You can not ASSIGN a public IP you your NAS. Only your ISP can do that and usually that incures an extra cost for more than 1 Public IP address. Usually included with a Business account and most of the time only available with a Business account. ISP do not want home owners running FTP or Mail servers on a residential acounts.
    As noted you have to forward the noraml FTP port, port 21, in your Router to the IP of the NAS. Since you already have that port forwarded to your Mac, which I have no idea why you did that, you have to either change that port forwarding to the NAS IP or make the FTP server on the NAS respond to some other port and forward that on the router to the IP of the NAS. The to access the NAS FTP server you have to enter the piblic IP address of your router followed with a :and port #. XXX.XXX.XXX.XXX:22 or whatever port # you assign to the FTP server on the NAS.

  • I can't get the VI Server/Client example to work on my PC

    Hi, I was trying to run the VI server and client example but the client could not find the server even when the server was running and both VI's were running on the same computer.
    I checked the VI Server configuration and found that the TCP/IP was not checked off - so I enabled TCP/IP. This did not solve the problem.
    Your help is appreciated
    Keita

    Are you running LabVIEW 7.0? The 7.1 version seems to work reliably but the 7.0 version does not to seem to work most of the time. I am having the same problems as you describe. Must be some bug in 7.0, but I have not had time to compare the code. Anyone?
    LabVIEW Champion . Do more with less code and in less time .

  • Looking for a specific feature in an FTP Client

    Hello!
    I am looking for a "simple" feature in any FTP client for OS X.
    I have tried Fetch, Transmit, CyberDuck and Interarchy 7.x and none had the ability to throttle uploads/downloads. I work with a limited bandwidth and sometimes have to download files (or upload) in the background but at a very slow speed (because the peer has a poor connection).
    None of these nice (and they are nice!) ftp programs can do this. I have to either use wget via the command line (wget --limit-rate=xx) or use Total Commander for Windows inside a Parallels Virtual Machine.
    Does anybody know about a Mac FTP client that can throttle and enqueue items easily?
    Thanks in advance!

    Look at "lftp". It as about a zillion parameters that can be set. One of them is "net:limit-total-rate"
    Quoted from the Docs....
    limit transfer rate of all connections in sum. 0 means unlimited. You can specify two numbers separated by colon to limit download and upload rate separately. Note that sockets have receive buffers on them, this can lead to network link load higher than this rate limit just after transfer beginning. You can try to set net:socket-buffer to relatively small value to avoid this.
    Find lftp here lftp.yar.ru It is also in thr Fink archive. http://fink.sourceforge.net/

  • FTP Clients on E72: can't get any to work

    Hello again.
    So, I've been trying to get FTP Client functionality on my Nokia E72. I guess I'm just doing something wrong, but I cannot figure it out.
    I tried:
    * SIC! FTP (native Symbian App)
    * PaderSyncFTP (Java)
    * MobyExplorer (Java)
    None of the applications work on my E72. They do work however (with the same SIM card) on my Nokia 6120 classic.
    The applications seemingly try to connect on the E72, however it never actually initiates a packet data connection at all. As if there wouldn't be an application trying to access the Internet.. I also tried to set up WLAN as my primary access point. Works for everything else, but not for those FTP clients.
    I tried several FTP servers on different ports (21, 666, 667). All work on 6120 classic, none work on E72. Also tried to switch from passive to active mode to no avail.
    Funny thing is: When I use my PuTTY SSH Client on E72 to just probe an FTP servers port, that works! I can see the connection attempt in my FTP Servers logfile, and I can see the Server responding in PuTTY!! But with the actual FTP clients i never even get out into the network, wether I try to use WLAN or 3.5G..
    I'm lost. Everything else works. SSH2 using PuTTY works, Skype works, webbrowsing works.
    What could be prohibiting all those FTP clients from initiating a connection?! For MobyExplorer I even tried all of its four "connection modes" that they have for "buggy firmwares". Doesn't make a difference at all.
    Also: Those apps never ask for an Access Point on the E72, even if the AP is configured to do so.
    I have no idea what to do...  Any advice would be appreciated! Maybe it's just some strange configuration issue..
    Thanks.

    k-lite is a free codec that makes windows media player 11 work and it has its own player.
    T430u, x301, x200T, x61T, x61, x32, x41T, x40, U160, ThinkPad Tablet 1838-22R, Z500 touch, Yoga Tab 2 Windows 8.1, Yoga Tablet 3 Pro
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    If someone helped you today, pay it forward. Help Someone Else!
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • Trying to install InDesign (Adobe) but when I double click the Install it calls up FTP Client Ultimate?? What is the install program for MACBook Pro?

    I'm new to MAC, that said I really haven't had much trouble with it except today I am trying to install Adobe InDesgin but it keeps trying to use FTP Client Ultimate  to do so.. What is the installer that it should be using? I was hoping it would auto start and install but no such luck..

    Thanks, I have posted to Adobe regarding their program, but my question here ( I'm new to Mac world) is what install program would normally install this? For some reason my MacBook pro keeps calling on FTP Client Ultimate to do the install and clearly that's not the right program to install a program..
    I Love mu Mac, but getting help is a it frustrating...
    i'm sure Apple has a program similar to InDesign, but have no idea what it would be..

Maybe you are looking for