|
-
Jan 17th, 2001, 02:46 PM
#1
Thread Starter
Member
Hi,
I am using the FTPOpenFile and InternetReadFile API calls for FTPing a file across a network. What would be the optimum size for the string I declare to be the buffer? Does it vary or is something like 4096 a good size?
I ask because it does seem that this generic FTP class I have is a bit slower at FTPing files than an actual FTP control. And if you are wondering why I am not using an FTP control, it is a long story but basically, I can not add any OCXs or DLLs to the existing system so I decided to use the API.
Thanks in advance.
Matt
-
Jan 17th, 2001, 04:02 PM
#2
Addicted Member
Well, according to the network-types where I work, it seems the optimal size would correspond to the network packet size. They tell me that each network sends information in what is called a packet, the size of which varies with each network. Transmitting data in a chunk smaller (or greater) than the network packet size can cause the system to transmit more packet than necessary.
There example was as follows: Say you are transmitting 8K of data, and each packet size is 4K. If you send the data in 4K chunks, it takes 2 packets to get data across. If you transmit in 3K chunks, it takes 3 packets (3K, then 3K, then the final 2K). If you transmit in 5K chunks, then it still takes 3 packets (4K, then 1K, then the remaining 3K).
Personally, it's all greek to me. But that's what our "egg-sperts" tell me...find your network packet size, and use that as your optimum.
Building A Better Body Albeit Left Out Under Intense Extrapolation
-
Jan 17th, 2001, 04:14 PM
#3
Thread Starter
Member
Thanks for the info. But I do have a question about that last 5K packet...why wouldn't it send a 5K packet, and then a 3K packet?
Matt
-
Jan 17th, 2001, 04:17 PM
#4
Addicted Member
Because the packet cannot send more than 4K at a time. If your program tells it to send 5K, it sends 4K (max packet size), then 1K to finish the 5K request, then a 3K packet to finish the transmittal.
Building A Better Body Albeit Left Out Under Intense Extrapolation
-
Jan 17th, 2001, 04:26 PM
#5
Thread Starter
Member
I think I follow what you are saying...if my packet size for the network is 4K, but I set my buffer to be 5K, then I have the 3 packets. If my network packet size was 5K though, then I would get one 5K packet and one 3K packet. Now that I think I have that understood, do you know how to determine the network packet size??
Thanks again.
Matt
-
Jan 17th, 2001, 05:04 PM
#6
Addicted Member
The word from MY network people is to ask YOUR network people, since each is dependent on the network hardware and software you have...sorry...
Building A Better Body Albeit Left Out Under Intense Extrapolation
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
|