More love 4 networking

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

More love 4 networking

Post by Melissa »

Since I recently tried to write my own FTP back-up functionality, plenty of ideas made their way into my head. Most of ‘em was things I wanted to make with developers of FTP protocol, yet some was about improvements of corresponding library. First, and most essential:

Code: Select all

*Handle = FtpID(#Ftp)
...Addition of such procedure would make FTP library a lot more convenient by adding possibilities to easily integrate with API. However, some additions still could be made:

Code: Select all

ExamineFTPDirectory(#Ftp, Pattern$ = “*.*”)
...Yes, I understand that patterns aren’t too useful in cases of recursive scanning, but same could be said of ExamineFTPDirectory itself, since right now it’s forcing people to use temporary storages. Still, there are some cases when it’s required just to find certain set of files in large directory, and API already supporting patterns for that task. Now, just to make life even easier:

Code: Select all

GetFTPFileSize(#Ftp, Filename$)
...Yes, size requesting is supported by API (at least Windows one) too. Most of time it could be extracted from directory listing, yet some time we needs to know size of certain file. While downloading it, for example.

P.S. Also, since I’m whining about networking anyway, once again: Fred\Freak, please, add (optional) timeout parameter to Receive~ family of procedures.
User avatar
Innesoft
Enthusiast
Enthusiast
Posts: 105
Joined: Mon Jan 18, 2010 10:30 am
Location: UK
Contact:

Re: More love 4 networking

Post by Innesoft »

Can't comment on the patern$="*.*" stuff (which I think needs to be client-side) but the file size thing is already in..

quoting the manual pretty much verbatim..

FTPDirectoryEntrySize() should return the size of the current entry but only on unix servers, and...

FTPDirectoryEntryRaw()

^Should return everything the server is willing to provide about the current entry, including date and size in bytes...

The example code for this returns the following...

Code: Select all

drwxr-xr-x    2 ftp      ftp          4096 Jun 23 15:01 tmp
drwxr-xr-x    2 ftp      ftp        655360 Jun 22 22:30 stats
drwxr-xr-x   10 ftp      ftp          4096 Nov 23  2009 pub
drwxr-xr-x    2 ftp      ftp          4096 Dec 24  2008 nzb
drwxr-xr-x    3 ftp      ftp          4096 May 28 10:39 mirrors
drwx------    2 ftp      ftp         16384 Mar 08  2006 lost+found
drwxr-xr-x    2 ftp      ftp          4096 May 07  2008 awstats
lrwxrwxrwx    1 ftp      ftp            28 Sep 27  2007 MPlayer -> mirrors/mplayerhq.hu/MPlayer
Innesoft - The Software Marketplace - Innesoft Blog
» Applications, Educational Software, Casual Games
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: More love 4 networking

Post by Melissa »

Code: Select all

Can't comment on the patern$="*.*" stuff (which I think needs to be client-side) but the file size thing is already in..
May be, may be: FtpFindFirstFile_(*hConnect, lpszSearchFile.s, *lpFindFileData.LPWIN32_FIND_DATA, dwFlags, *dwContext)
Well, I don't know about other OS, but let me doubt that *nixes would handle networking stuff worse than Windows.
but the file size thing is already in..
I agree, but refernced situation requires it to be in completely different place. Something less bound to ExamineFTPDirectory would be fine.
Post Reply