Results 1 to 7 of 7
  1. #1
    m_chenna is offline Member
    Join Date
    Feb 2011
    Posts
    7
    Rep Power
    0

    Default how to transfer file from to another by using FTP in java

    hi,


    please provide the information about the how how to transfer file from to
    another by using FTP in java..

    please provide the source code

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,778
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by m_chenna View Post
    hi,


    please provide the information about the how how to transfer file from to
    another by using FTP in java..

    please provide the source code
    Did you miss my reply in your other thread? (also in completely the wrong sub-forum) or did you chose to bluntly ignore it and simple ask your question again?

    kind regards,

    Jos

    ps. both threads reported
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    bhavesh_4349 is offline Member
    Join Date
    Feb 2011
    Posts
    3
    Rep Power
    0

    Smile Help

    tell me also how to transfer file...:(

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,778
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by bhavesh_4349 View Post
    I want forum database design.....plz help me........
    Do you want fries on top of that?

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    bhavesh_4349 is offline Member
    Join Date
    Feb 2011
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Do you want fries on top of that?

    Jos
    yes...........

  7. #7
    mahati1542 is offline Member
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Default ftp

    this is a small program
    the program is as follows
    server program///
    import java.io.*;
    import java.net.*;
    public lass ftps
    {
    public static void main(String ar[])
    {
    Socket s;
    ServerSocket server;
    FileInputStream fis;
    BufferedReader br;
    PrintWriter pw;
    String filename;
    int c;
    try
    {
    server=new ServerSocket(1111);
    System.out.println("server is waiting for the connection");
    s=server.accept();
    System.out.println("connection established");
    br=new BufferedReader(new InputStreamReader(s.getInputStream()));
    pw=new PrintWriter(s.getOutputStream());
    filename=br.readLine();
    fis=new FileInputStream(filename);
    while((c=fis.read())!=-1)
    {
    pw.print((char)c);
    pw.flush();
    }
    System.out.println("file copied");
    s.close();
    }
    catch(Exception e)
    {
    System.out.println(e)
    }
    }
    }

    client program
    import java.net.*;
    import java.io.*;
    public class cli
    {
    public static void main(String ar[])
    {
    Socket s;
    BufferedReader br;
    PrintWriter pw;
    String spath,dpath;
    FileOutputStream fos;
    int c;
    try
    {
    s=new Socket("localhost",1111);
    in=new BufferedReader(new InputStreamReader(System.in));
    br=new BufferedReader(new InputStreamReader(s.getInputStream()));
    pw=new PrintWriter(s.getOutputStream());
    System.out.println("enter the source");
    spath=in.readLine();
    System.out.println("enter the destination");
    dpath=in.readLine();
    fos=new FileOuptustream(dpath);
    while((c=br.read())!=-1)
    {
    fos.write();
    fos.flush();
    }
    System.out.println("file reached");
    }
    catch(Exception e)
    {
    System.out.println(e);
    }
    }
    }

Similar Threads

  1. File Transfer using java.IO
    By cheng in forum New To Java
    Replies: 0
    Last Post: 12-14-2009, 05:42 AM
  2. file transfer
    By prashant in forum Networking
    Replies: 3
    Last Post: 12-10-2009, 07:46 AM
  3. Regarding File Transfer in TCP/IP
    By manabendra in forum Networking
    Replies: 2
    Last Post: 08-07-2009, 08:51 AM
  4. data loss in the secure file transfer using java
    By antony75 in forum Networking
    Replies: 4
    Last Post: 02-09-2009, 07:56 AM
  5. Java File Transfer
    By lks0912 in forum Advanced Java
    Replies: 0
    Last Post: 10-23-2008, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •