The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hello, I want to check if my Mobilink server is running from a C# application and notify the user if there is a problem and the server is down. Is there a way to do something like ping?

asked 17 Apr '12, 09:38

katalun4o's gravatar image

katalun4o
331121521
accept rate: 85%


This is how i did this. I used the PingOnly option in sync params.

try
        {
            ULCreateParms createParms = new ULCreateParms();
            createParms.CaseSensitive = true;
            createParms.UTF8Encoding = true;
            ULConnectionParms openParms = new ULConnectionParms();
            string appPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
            string testPingDbFileName = System.IO.Path.Combine(appPath, "ping.udb");
            openParms.DatabaseOnDesktop = testPingDbFileName;

            if (System.IO.File.Exists(testPingDbFileName) == false)
            {
                iAnywhere.Data.UltraLite.ULDatabaseManager.CreateDatabase(
                openParms.ToString(),
                createParms.ToString()
              );
            }

            ULConnection cn = new ULConnection(openParms.ToString());

            cn.Open();
            cn.SyncParms.PingOnly = true;
            cn.SyncParms.UserName = "sa";
            cn.SyncParms.Stream = ULStreamType.HTTP;
            cn.SyncParms.StreamParms = string.Format("host={0};port={1}",mobilinkServer,mobilinkPort);
            cn.SyncParms.Version = mobilinkVersion;
            cn.Synchronize();
            object a = cn.SyncResult;
            cn.Close();
            isOnline = true;
        }
        catch (Exception ex)
        {
            isOnline = false;
        }
permanent link

answered 18 Apr '12, 10:12

katalun4o's gravatar image

katalun4o
331121521
accept rate: 85%

Would the SQL Anywhere monitor be an option?

"The SQL Anywhere Monitor, also referred to as the Monitor, is a browser-based administration tool that provides you with information about the health and availability of SQL Anywhere databases (including databases in read-only scale-out and mirroring systems), MobiLink servers, MobiLink server farms, and Relay Server farms."

permanent link

answered 17 Apr '12, 10:20

Tom%20Slee's gravatar image

Tom Slee
1.0k21027
accept rate: 25%

I want to implement it in my application, not to use any other monitoring tools. In a period of time to try to sync or to ping and see if there is connection to the server, if there is not a connection to show the user who is working a message.

(17 Apr '12, 10:54) katalun4o

I guess the ML client ping utility will do:

dbmlsync -pi -c connection_string ...


Apparently, the DbmlSync .NET API has an according method with a very different goal - see Reg's explanation:

DbmlsyncClient class Ping method

permanent link

answered 17 Apr '12, 11:15

Volker%20Barth's gravatar image

Volker Barth
29.3k287438644
accept rate: 32%

edited 17 Apr '12, 14:58

1

The Ping method in the dbmlsync client API (either the C++ or .NET implementation) is a ping of the dbmlsync process, and not the MobiLink Server.

If you are using a SQL Anywhere remote, then dbmlsync -pi is perfect, and if you are using UltraLite, setting the "ping" member of the synch info class you pass to the Synchronize function will perform a minimal connection to the MobiLink Server.

(17 Apr '12, 13:18) Reg Domaratzki

In addition to Volker's comments, and you're using SQL Anywhere 12, you could also launch "mlreplay -ping seconds" from your application and check the return code for the utility:

  • -1 - Indicates that an error occurred.
  • 0 - Indicates that mlreplay was able to ping the server and the server is ready to receive synchronizations.
  • 1 - Indicates that mlreplay tried to ping the server but got no response; therefore, the server is not ready to receive synchronizations.

Another API alternative is to use the DBTools DBSynchronizeLog function, and pass in a "a_sync_db" structure with the "ping" struct member set to "TRUE". See: http://dcx.sybase.com/index.html#1201/en/mlclient/mc-dbtools.html.

permanent link

answered 17 Apr '12, 13:19

Jeff%20Albion's gravatar image

Jeff Albion
10.7k171174
accept rate: 24%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×265
×25

question asked: 17 Apr '12, 09:38

question was seen: 1,897 times

last updated: 18 Apr '12, 10:12