[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ftpapi questions



Sender: Scott Klement <klemscot@xxxxxxxxxxxx>



On Mon, 30 Sep 2002, Richard B Baird wrote:

> Scott,
>
> Finally, a couple of specific questions.
>
> FTP_dir returns a pointer (peRtnList) specifying the beginning of the
> directory data found.
>
> in looking over your code, List2Array defines that data with a varying
> string with a maximum of 8192.  Is this the maximum?  this only allows for
> 32 entries returned to the program, right? (since each directory entry is
> 256 bytes long)

No, that's not true.  You're combining two different ideas.

The FTP_List and FTP_Dir routines put all the data into an array.  Each
element of the array is 256 bytes long.  There is no limit, other than
that imposed by OS/400, for the number of entries that can be in the
array.   There is, of course, a maximum length of EACH entry, of 256
bytes.  That is, a single filename cannot exceed 256 bytes if you use
FTP_List or FTP_Dir.

The FTP_Dirraw and FTP_Listraw routines can send up to 8192 bytes per
entry of the array.   That is, a single filename, or a single "line in the
directory listing" can be up to 8k long using these routines.

This allows you to write your own routines that handle longer names than
256 bytes, if you find that length to be too restrictive.   (But, I didn't
want to waste the memory of having 8192 byte array entries for normal
use.)

at any rate, that 8192 is PER LINE, not the total size of the listing!

>
> If I want to get more than 32, can I just increase the size of the pointer
> based variable in my program?  or do I also have to increase the size of
> the variable in List2Array too?  Is there a limit to how many directory
> entries you can recieve?
>

There is no limit, other than what the operating system and/or compiler
imposes upon you.   For example, using the ALLOC keyword in RPG, you
can only reserve up to 16776704 bytes of memory.  So, you might consider
that to be a limitation, but it's not imposed by FTPAPI.

Of course, you could instead pass a pointer to a user-space that you've
pre-created to be 16gb long...   That would allow you to return, what?  64
million directory entries.  Again, that limit isn't imposed by FTPAPI,
but by the operating system.

You could even get around THAT limit by using FTP_dirraw and outputing
the results to a PF with *NOMAX for it's size...  So, FTPAPI really tries
it's best not to limit you :)



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------