-
October 22nd, 2003, 01:04 AM
#1
About FTP~!~
hi, all
I am doing a project which would download files to a fixed place from a FTP server. And every file would need a new thread. How should I do? I'd never do something about this.
Nimking
-
October 22nd, 2003, 01:57 AM
#2
You can use WinInet
For each file you have to establish a new session with the FTP Server
All u have to do is to make a class which should take username, password, and file path (to be downloaded or uploaded to and from server) in it's constructor and that class should make a thread for that file and start all the remaining process as memtioned in WinInet classes
-
October 22nd, 2003, 02:01 AM
#3
You can use MS WinInet API (search http://msdn.microsoft.com/library for more info).
Here's a short desciption on how to do it with WinINet API:
1. Open internet session with InternetOpen()
2. Connect to FTP server with InternetConnect()
3. Download a file with FtpGetFile()
4. Close both handles (1, 2) with InternetCloseHandle()
For threading, lookup these functions in the online help:
1. CreateThread
2. _beginthread
3. _beginthreadex
Hope it helps.
-
October 22nd, 2003, 02:18 AM
#4
Link
Hi,
You might want to take a look at http://www.geocities.com/contactgirish/ftp.html
for code related to uploading and downloading files from a
FTP server. Its not multithreaded, but that'd be easy to
implement. Take a look in the MSDN for creating and handling
threads.
Hope this helps.
-
October 22nd, 2003, 02:29 AM
#5
If I use two threads download two files at the same time, does it make a wrong? Does I need to split the file?
-
October 22nd, 2003, 02:31 AM
#6
Originally posted by Nimking
If I use two threads download two files at the same time, does it make a wrong? Does I need to split the file?
It should work to download two files from separate threads. Note however that the files won't be downloaded faster using two or more threads!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|