enterprisedt.com Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Question about callbacks
Author Message
Reply with quote
Post Question about callbacks 
An Integral FTP user asks:
Quote:
So, I’m uploading a group of about 10 files, hopefully one after the other.

The process starts, and I have a call for ftp.localSize(sUploadFullFileName); to get the size of the file on the local system. After that, the process calls my OnLocalFileSize(status, filename, filesize) and I get the file size. Then, I start the transfer using ftp.uploadFile(sUploadFullFileName, sUploadFileName, 1); and have an onTransferProgress function.

Code:
onTransferProgress(status, rFileName, bCount)

The weird thing is, the onTransfer does not always return me the same filename that I was uploading and the bCount appears to match the filename getting returned and not the one that I tried to send up.

Is this an asynchronis thing or am I being a dufus again?


View user's profile Send private message Send e-mail
Reply with quote
Post  
Integral FTP uses a connection-pool to enable it to transfer multiple files simultaneously. Version 1.0 uses a fixed pool of 5 connections. So if you launch 10 uploads then it'll start uploading 5 of them immediately and upload the other 5 as connections are freed up when other uploads complete.

onTransferProgress will be called for all files that are currently being uploaded. So in your case the first callback you receive could belong to any of the 5 files that are being transferred first. In other words, you can't assume that the first callback will belong to the first file that you requested to be uploaded.

There are two ways you can tell which callback invocation belongs to which file. One is the file-name argument. The other is the taskID which is a property of the status argument. The taskID uniquely identifies the uploadFile operation that you request for a particular file. It is returned by the FTPClient.uploadFile method.

- Hans (EnterpriseDT)

View user's profile Send private message Send e-mail
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum