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 - Server-Initiated Synchronization » Setting Up Server-Initiated Synchronization » Listeners » Message handlers

Using the filters message, message_start, and sender Next Page

Connection-initiated synchronization


In addition to initiating synchronization from the server, on Windows devices you can also initiate synchronization when connectivity changes. This is possible because the Windows Listener generates an internal message with the content _IP_CHANGED_ whenever there is a change in connectivity, and it generates an internal message with the content _BEST_IP_CHANGED_ whenever there is a new "best" IP connection.

The internal messages _IP_CHANGED_ and _BEST_IP_CHANGED_ are generated only on Windows devices, including Windows CE.

Identifying a change in the optimum path to a MobiLink server

An IP connection is considered to be "best" if it is the best connection to use when connecting to the MobiLink server that is specified with the dblsn -x option. Although the "best" designation is defined by the path to the MobiLink server, in practice it tends to indicate the best IP connection to use in general.

To make use of a change in the best IP connection, use the keyword _BEST_IP_CHANGED_ in your message filter. A MobiLink server is required as a destination for the network to determine which route is optimal, so you must also specify connection parameters for a MobiLink server using the -x option. The message filter should be of the form:

-l "message='_BEST_IP_CHANGED_';action=..."

The $best_ip action variable is very useful with the _BEST_IP_CHANGED_ filter. The value of $best_ip is the local IP address that represents the best IP connection. If there is no IP connection, $best_ip has the value 0.0.0.0.

You can only use _BEST_IP_CHANGED_ when the Listener is run on a separate machine from the MobiLink server.

In the following example, the _BEST_IP_CHANGED_ filter is used to initiate a synchronization when the best IP connection changes. If the connection is lost, an error is generated.

dblsn -x http(host=mlserver.company.com) 
   -v2 -m -i 3 -ot dblsn.log 
   -l "message=_BEST_IP_CHANGED_;
       action='start dbmlsync.exe -ra -c eng=remote;uid=DBA;pwd=sql
               -n test_pub'"
Identifying any change in connectivity

To make use of a change in IP connectivity on your remote device, use the keyword _IP_CHANGED_ in your message filter. _IP_CHANGED_ only indicates that there has been a change in IP connectivity. The message filter should be of the form:

-l "message='_IP_CHANGED_';action=..."

The following example shows a message handler that can be used in the dblsn command line. The filter captures messages that contain the content _IP_CHANGED_. The action makes use of the action variables $adapters and $network_names. If the connection is lost, an error is generated.

-l "message=_IP_CHANGED_;
    action='socket port=12345;
         sendText=IP changed: $adapters|$network_names;
     recvText=beeperAck;
     timeout=5';
    continue=yes;"
See also