Results 1 to 6 of 6

Thread: Optimum string size for InternetReadFile

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 1999
    Location
    Warner Robins, GA
    Posts
    37

    Question

    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

  2. #2
    Addicted Member Babbalouie's Avatar
    Join Date
    Jan 2001
    Location
    On the bright, blue sea...
    Posts
    197
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 1999
    Location
    Warner Robins, GA
    Posts
    37
    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

  4. #4
    Addicted Member Babbalouie's Avatar
    Join Date
    Jan 2001
    Location
    On the bright, blue sea...
    Posts
    197
    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

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 1999
    Location
    Warner Robins, GA
    Posts
    37
    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

  6. #6
    Addicted Member Babbalouie's Avatar
    Join Date
    Jan 2001
    Location
    On the bright, blue sea...
    Posts
    197
    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
  •  



Click Here to Expand Forum to Full Width