• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FilesDownload from FTP

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings!.

I have a big issue while downloading the files from FTP Server. The below is description of the project,
1) To connect ftp server
2) Pass the folder structure to FTP server
3) Found the folder and files within directory
4) List the files which is available in the folder
5) User can able to select the files
6) In the Pop up window have two options, Start download / Cancel.
7) If user selected "Start download" files gettting download to our Local PC.
---> Here, I have issues, if user select the start download action the files getting download to server only not for my machine (PC).
ALso i have used Socket to connect the client machine but i am not getting the connection from server to local port.
the below is my code
Socket ClientSocket = new Socket("localhost IP", Port).
the above line is getting error while running my code.
----
Can any one help me out to solve this issue.
(I need to download the files to my machine only not for server level. If any one have idea pls share me., it will be greate help). You can suggest me !!!.

Thanks,
Loganathan M
mspilogan@yahoo.com
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

the files getting download to server only not for my machine
...
I need to download the files to my machine only not for server level.


I don't understand what these mean. You want to download the files from the server to the local machine, correct? What happens after you start the download?

Is there a particular reason you're not using a ready-made FTP library like Apache Commons Net?
 
loganathan manickavasakam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings!..

thanks for your response..

Yes you are correct...I want to download the files from server to my local machine (from web).
After clicking the start download, the files are getting download to server only without any issues. Bur here i need to download to my local PC.


Yes, Actually i am using the library from Apache commons net. I am not sure about which jar file you are refereing from apache. If you dont mind please send me the link .

the below link i have used the jar file from apache.
http://www.informit.com/guides/content.aspx?g=java&seqNum=40
commons-net-1.0.0.jar

Thanks,
Loganathan M
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Downloading" generally means from a server to a client. So I'm not sure what you refer to when "the files are downloaded to the server fine", when really you want to download them to the local machine.

Where is this "Start Download" button - is this a desktop application running on the local machine?

I'd advise to get the latest version of Commons Net. Googling for "download apache commons net" should lead you to Apache's site.
 
loganathan manickavasakam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using servlet for downloading the files.

here is some more details,
1) Connecting FTP server by using servlet and bring pop up window
2) Popup window have list of Files, and files are displaying based up on the user selected from parent page.
3) Those files are available in server.
4) This pop up window (dev HTML page within servlet). Also have start download / cancel button.
5) If user clicks start download button, the startdownload will connect to FTP client and files are getting download.
6) Here we are passing two parameter (server path, local path). Local path i am giving my ip address but the server is not connecting to me local drive. This will give an error message called "Connection refused". If i am not passing any ip means this will take server drive as local drive and files are getting download in server itself.

7) thats why i user socket to connect the Client port as well as server port.
8) Server port is getting connected..
Scoket sServer = new Socket()
sServer.accept();
this is getting connected,,

but the same CLient socket
Socket sClient = new Socket("Ipaddress", port).
this is not connecting..

txs
logas
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I get it - the web app FTPs a file from somewhere, and you then want that file downloaded to your local machine.

The easiest way to achieve this would be for the web app to store the file somewhere on the server, and then create a web app that has a link to that file.
 
loganathan manickavasakam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.. Basically i am Lotus notes developer not for java. Could you please guide me or send me the sample code. I will intergtate it to my application and let you know the results.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What code are you looking for - for generating a link on a web page? That's all that's left, really, since you said is file is stored on the server already.
 
loganathan manickavasakam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I need the code for weblink.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you generate the web pages?

Including something like <a href="http://www.server.com/myWebApp/myFiles/file.txt">download file</a> shouldn't be hard no matter how you do it, though. The file name would need to be dynamically inserted, of course.
[ June 23, 2008: Message edited by: Ulf Dittmer ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[ mamun, please don't post questions in an existing thread that are only tangentially related, if at all. That's called "hijacking", and frowned upon. Start a new topic instead. ]
[ June 24, 2008: Message edited by: Ulf Dittmer ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic