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

SQL Anywhere 10.0.1 » MobiLink - Client Administration » UltraLite Clients » Designing synchronization in UltraLite

Table order in UltraLite Next Page

Adding synchronization to your UltraLite application

In UltraLite, synchronization begins by opening a specific connection with the MobiLink server over the configured communication stream (also known as a network protocol). In addition to synchronization support for direct network connections, Palm OS devices also support HotSync synchronization, and Windows CE devices also support ActiveSync synchronization.

Defining the connection

Each UltraLite remote that synchronizes with a MobiLink server does so over a network protocol. You set the network protocol with the synchronization stream parameter. Supported network protocols include TCP/IP, HTTP, HTTPS, and TLS. For the protocol you choose, you also need to supply stream parameters that define other required connection information like the MobiLink server host and the port.

Remember to also supply the MobiLink user information and the synchronization script version with the user_name and version parameters.

Defining the synchronization behavior

You can control synchronization behaviors by setting various synchronization parameters. The way you set parameters depends on the specific UltraLite interface you are using.

Important behaviors to consider include:

To add synchronization code to your UltraLite application
  1. Supply the necessary synchronization parameters and protocol options you require for the session as fields of a synchronization information structure.

    For example, using the C/C++ API, you add synchronization to the UltraLite application by setting appropriate values in the ul_synch_info structure:

     ul_synch_info info;       
           // define a sync structure named "info"
            ULEnableTcpipSynchronization( &sqlca );
           // use a TCP/IP stream
           conn->InitSynchInfo( &info );
           // initialize the structure
  = ULSocketStream();
           // specify the Socket Stream
           info.stream_parms= UL_TEXT( "host=myMLserver;port=2439"  );
           // set the MobiLink host information
           info.version = UL_TEXT( "custdb 10.0" );
           // set the MobiLink version information
           info.user_name = UL_TEXT( "50" );
           // set the MobiLink user name
           info.download_only =ul_true;
           // make the synchronization download-only
  2. Initialize synchronization.

    For direct TCP/IP-based synchronization, you would call an API-specific synchronization function. These functions return a boolean indicating success or failure of the synchronization operation. If the synchronization fails, you can examine detailed error status fields in another structure to get additional error information.

    For HotSync synchronization, you must the ULSetSynchInfo function, supplying the ul_synch_info structure as an argument. This attaches the ul_synch_info structure to the current database for use on a subsequent synchronization.

    For ActiveSync synchronization, you must catch the synchronization message from the ActiveSync provider and use the DoSync function to call ULSynchronize.

  3. Use an observer callback function if you want to report the progress of the synchronization to the user.


    If you have an environment where DLLs fail either because the DLL is very large or the network connection is unreliable, you may want to implement resumable downloads. See Handling failed downloads and Resuming failed downloads.

See also