Datasnap.DSServer.TDSServer.Start

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Start; override;

C++

virtual void __fastcall Start();

Properties

Type Visibility Source Unit Parent
procedure
function
public
Datasnap.DSServer.pas
Datasnap.DSServer.hpp
Datasnap.DSServer TDSServer

Description

Starts the DataSnap server.

Start starts the DataSnap server. The Start method internally calls the Start method for all TDSServerTransport component implementations and all TDSServerClass components that have their Server property set to this instance.

The Start method is called automatically when the component is loaded if the AutoStart property is set to True.

The code snippets below illustrate the creation of a run-time DataSnap server (the snippets are complete with Start and Stop methods.) As TDSServer is a visual component, if it is dragged onto a form, it does not need to be manually created as in the snippets below. However, the starting and stopping procedures are the same.

var
  MyDSServer: TDSServer;

begin
  { Create a DataSnap server. }
  MyDSServer := TDSServer.Create(Self);

  { Start the DataSnap server. }
  MyDSServer.Start;

  { Inform the user whether the DataSnap server was started. }
  if MyDSServer.Started then
    ShowMessage('My DataSnap server is started.') else
    ShowMessage('Could not start the DataSnap server.');

  { Stop the DataSnap server and release memory. }
  MyDSServer.Stop;
  MyDSServer.Free;
end;
{
  TDSServer *MyDSServer;

  /* Create a DataSnap server. */
  MyDSServer = new TDSServer(this);

  /* Start the DataSnap server. */
  MyDSServer->Start();

  /* Inform the user whether the DataSnap server was started. */
  if (MyDSServer->Started)
  {
    ShowMessage("My DataSnap server is started.");
  } else
  {
    ShowMessage("Could not start the DataSnap server.");
  }

  /* Stop the DataSnap server and release memory. */
  MyDSServer->Stop();
  MyDSServer->Free();
}

See Also