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

SQL Anywhere 11.0.0 » MobiLink - Client Administration » Introduction to SQL Anywhere Clients for MobiLink » Dbmlsync API » Dbmlsync API for C++


StartServer method

This method first checks to see if there is a dbmlsync server listening on the specified port. If a server is present, the method returns without further action. If no server is found, the method starts a new server using the options specified by the cmdline argument and waits for it to start accepting requests before returning.

bool StartServer( unsigned port, const char *cmdline, unsigned timeout, DBSC_Starttype *starttype );
  • port    The TCP port to check for an existing dbmlsync server. If a new server is started, it is set to listen on this port.

  • cmdline   A valid command line for starting a dbmlsync server. The command line may contain only the following options which have the same meaning that they do for the dbmlsync utility:

    • -a, -c, -dl, -do, -ek, -ep, -k, -l, -o, -os, -ot, -p, -pc+, -pc-, -pd, -pp, -q, -qi, -qc, -sc, -sg, -sp, -uc, -ud, -ui, -um, -un, -ux, -v[cnoprsut], -wc, -wh. See dbmlsync syntax.

    The -c option must be specified.

  • timeout   The maximum time in milliseconds to wait after a dbmlsync server is started for it to be ready to accept requests. Use DBSC_INFINITY to wait forever.

  • starttype   This is an ‘out’ parameter. If starttype is non-null on entry and StartServer returns true, then on exit the variable pointed to by starttype is set to one of the following values:

    • DBSC_SS_STARTED   Indicates that a new synchronization server was started.

    • DBSC_SS_ALREADY_RUNNING   Indicates that an existing synchronization server was found, so no new server was started.

Return value

Returns true if the server was already running or was successfully started.

Returns false if the server was not successfully started or the server did not begin processing requests before the timeout expired. When false is returned, you can call the GetErrorInfo method to get more information about the failure. See GetErrorInfo method.