On Windows devices, you can initiate synchronization when connectivity changes.
When IP connectivity is gained or lost, the device sends a push notification to the Listener with the message _IP_CHANGED_. When the device finds a new optimum path to the MobiLink server, it sends a push notification to the Listener with the message _BEST_IP_CHANGED_. Using a message handler, you can detect these changes in connectivity and initiate an action.
The _IP_CHANGED_ message indicates that a change in IP connectivity has occurred. A change usually occurs when a device is within range of a WiFi network, when the user makes a RAS connection, or when the user puts the device in a cradle. You can reference the _IP_CHANGED_ message by running the Listener with the following syntax:
dblsn ... -l "message=_IP_CHANGED_;action='...'" |
The following example demonstrates how to use the _IP_CHANGED_ message. The message handler filters the message, and sends it to the server. If the connection is lost, an error is generated.
dblsn -l "message=_IP_CHANGED_; action=' SOCKET port=12345; sendText=IP changed: $adapters|$network_names; recvText=beeperAck; timeout=5'; continue=yes;" |
The _BEST_IP_CHANGED_ message indicates that a change in the optimum path to the MobiLink server has occurred. You can reference this message when you run the Listener with the following syntax:
dblsn ... -x MobiLink-protocol-options -l "message=_BEST_IP_CHANGED_;action='...'" |
When filtering the _BEST_IP_CHANGED_ message, the $best_ip action variable, which substitutes the local IP address that represents the best IP connection, can help you initiate useful actions. If there is no IP connection, $best_ip returns 0.0.0.0.
In the following example, the _BEST_IP_CHANGED_ message 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'" |
When testing connectivity-initiated synchronization with your applications, run the Listener on a separate computer from your MobiLink server.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |