Re: [PHP-DEV] New FTP extension functionality

2002-08-03 Thread Andi Gutmans

At 02:05 PM 7/30/2002 -0400, Joao Prado Maia wrote:

So are we going to rename these functions because of this ? It seems kind
of weird of having ftp_async_get() when the function is not really
asynchronous ;)

If what Sterling just said is really accurate, _please_ don't release
4.3.0 with the wrong function names. It just doesn't look professional :)

I agree :)
It should probably be something like ftp_nb_get().

Andi


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] New FTP extension functionality

2002-07-30 Thread Joao Prado Maia

On Tue, 30 Jul 2002, Sterling Hughes wrote:

  Hi,
 
  yesterday I did several commits to the FTP extension. Due to the fact that
  I do not know how I can document the stuff myself and right now am lacking
  the time here is a brief instruction:
 

 The work looks quite cool, however this is really not asynchronous i/o,
 but rather non-blocking i/o.


So are we going to rename these functions because of this ? It seems kind
of weird of having ftp_async_get() when the function is not really
asynchronous ;)

If what Sterling just said is really accurate, _please_ don't release
4.3.0 with the wrong function names. It just doesn't look professional :)

--
João Prado Maia [EMAIL PROTECTED]
http://phpbrasil.com - php com um jeitinho brasileiro


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] New FTP extension functionality

2002-07-29 Thread Sterling Hughes

 Hi,
 
 yesterday I did several commits to the FTP extension. Due to the fact that
 I do not know how I can document the stuff myself and right now am lacking
 the time here is a brief instruction:
 

The work looks quite cool, however this is really not asynchronous i/o,
but rather non-blocking i/o.

-Sterling

 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] New FTP extension functionality

2002-07-27 Thread Stefan Esser

Hi,

yesterday I did several commits to the FTP extension. Due to the fact that
I do not know how I can document the stuff myself and right now am lacking
the time here is a brief instruction:

Stefan Esser

---
5 new constants
---

FTP_AUTOSEEK new option for get/set_option: when enabled (which is default)
 get/put requests with a resumepos/startpos will first seek
 to the wanted position within the stream
 
FTP_AUTORESUME   automaticly determine resumepos/startpos for get/put request
 (does only work if AUTOSEEK is enabled)

FTP_FAILED   asynchronous transfer has failed
FTP_FINISHED asynchronous transfer has finished
FTP_MOREDATA asynchronous transfer is still active

New optional 5th parameter
--

Added optional startpos to ftp_put/ftp_fput (works like in the async examples)
Added optional resumepos to ftp_get/ftp_fget (works like in the async examples)

New asynchronous FTP functions
--

int ftp_async_get(resource ftp_stream, string local_file, string remote_file, int 
mode[, int resumepos])
int ftp_async_fget(resource ftp_stream, resource fp, string remote_file, int mode[, 
int resumepos])
int ftp_async_put(resource ftp_stream, string remote_file, string local_file, int 
mode[, int startpos])
int ftp_async_fput(resource ftp_stream, string remote_file, resource fp, int mode[, 
int startpos])
int ftp_async_continue(resource ftp_stream)


Example (Downloading a file):
-

...
// Initate the Download
$ret = ftp_async_get ($my_connection, test, README, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue downloading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error downloading the file...;
   exit(1);
}
...

Example (Uploading a file):
-

...
// Initiate the Upload
$ret = ftp_async_put ($my_connection, test.remote, test.local, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue uploading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error uploading the file...;
   exit(1);
}
...


Example (Resume downloading a file):


...
// Initate 
$ret = ftp_async_get ($my_connection, test, README, FTP_BINARY, 
  filesize(test));
// OR: $ret = ftp_async_get ($my_connection, test, README, 
//   FTP_BINARY, FTP_AUTORESUME);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue downloading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error downloading the file...;
   exit(1);
}
...

Example (Resume uploading a file):
--

...
// Initiate
$ret = ftp_async_put ($my_connection, test.remote, test.local, 
  FTP_BINARY, ftp_size(test.remote));
// OR: $ret = ftp_async_put ($my_connection, test.remote, test.local, 
//   FTP_BINARY, FTP_AUTORESUME);

while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue uploading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error uploading the file...;
   exit(1);
}
...

Example (Resume downloading at position 100 to a new file):
---
...
// Disable Autoseek
ftp_set_option ($my_connection, FTP_AUTOSEEK, FALSE);

// Initiate
$ret = ftp_async_get ($my_connection, newfile, README, FTP_BINARY, 100);
while ($ret == FTP_MOREDATA) {

   ...
   
   // Continue downloading...
   $ret = ftp_async_continue ($my_connection);
}
...

newfile is now 100 bytes smaller than README on the ftp because
we started reading at offset 100. If we have not have disabled
AUTOSEEK the first 100 bytes of newfile will be '\0'...



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php