Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » UltraLite - Database Management and Developer Guide » UltraLite as a MobiLink client » UltraLite clients

MobiLink file transfers

UltraLite supports the ability to transfer files with the MobiLink server.

For all other APIs, use the MobiLink file transfer mechanism when:

  • You have multiple files that you need to deploy to multiple devices, particularly when corporate firewalls are used as a security measure. Because MobiLink is already configured to handle synchronization through these firewalls, the MLFileTransfer mechanism makes device provisioning for upgrades and other types of file transfers very convenient.

  • You have files that you want to target to a specific MobiLink user ID. This requires that you create one or more user-specific directories on the MobiLink server for each user ID. Otherwise, if you only have a single version of the file, you can use a default directory.

How file transfers work

You can employ one of two MobiLink-initiated file transfer mechanisms to download files to a device: run the mlfiletransfer utility for desktop transfers, or call the appropriate function for the API you are using to code your UltraLite application. Both approaches require that you:

  1. Describe the transfer destination.

    Whether you use the mlfiletransfer utility from the desktop, or whether you use the function appropriate to your API, you must set the local path and file name of the file on the target device or desktop computer. If none are supplied in the application or by the end user, then the source file name is assumed and the file is stored in the current directory.

    The destination directory of the target can vary depending on the device's operating system:

    • On Windows Mobile, if the destination is NULL, the file is stored in the root directory ( \ ).

      The file name must follow file name conventions for Windows Mobile.

    • On the desktop, if the destination is NULL, the file is stored in the current directory.

      The file name must follow file name conventions for the desktop system.

    • On Apple iOS, you should store files in your application's document directory. You can get the location of the document directory by calling the NSSearchPathForDirectories/uDomains using the NSDocumentDirectory parameter.

  2. Set the MobiLink user credentials that allow the user to be identified and the correct file(s) to be downloaded.

    This user name and password are separate from any database user ID and password, and serve to identify and authenticate the application to the MobiLink server.

  3. Set the stream type you want to use, and define the parameters for the desired stream. These are the same parameters supported by UltraLite for MobiLink synchronization.

    Most synchronization streams require parameters to identify the MobiLink server address and control other behavior. If you set the stream type to a value that is invalid for the platform, the stream type is set to TCP/IP.

  4. Describe the required behavior for the transfer mechanism.

    For example, you can set properties that allow this mechanism to force a download even when the file already exists on the target and has not changed, or that allow partial downloads to be resumed. You can also set whether you want the progress to be monitored and reported upon.

  5. Ensure the MobiLink server is running and has been started with the -ftr option.

  6. Start the transfer, and, if applicable, monitor the download progress.

    By displaying the download progress, the user can cancel and resume the download at a later time.