DataSnap.Basic DataSnap Client and Server Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows how to create a DataSnap Server and a DataSnap Client.

Location

You can find the Basic DataSnap Client and Server Sample sample project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and then navigate to Object Pascal\DataSnap\Basic.
  • Subversion Repository:
    • You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

The Basic DataSnap Client and Server application demonstrates:

  • How to create a DataSnap Server application.
  • How to create a DataSnap Client application.

How to Use the Sample

There are three projects in subdirectories of the Basic directory:

Server Project

  1. Navigate to Start | Programs | Embarcadero RAD Studio Alexandria | Samples and go to Object Pascal\DataSnap\Basic\Server.
  2. Open the DataSnapTestServer.dproj project.
  3. Build the DataSnapTestServer.dproj project.
  4. Run the application by clicking Run > Run in the IDE or by pressing F9.
  5. The Server's interface shows you an Event Log and an Active Connections chart. These auto-populate when the Client attempts to connect to the Server.

Client Project

  1. Navigate to Start | Programs | Embarcadero RAD Studio Alexandria | Samples and go to Object Pascal\DataSnap\Basic\Client.
  2. Open the DataSnapTestClient.dproj project.
  3. Build the DataSnapTestClient.dproj project.
  4. Run the application by clicking Run > Run in the IDE or by pressing F9.
  5. The Client application enables you to test the server method class, the server method component, and the provider.

DataSnap Server Methods Example Project

This client application is a collection of dunit tests. These are not rigorous tests. They provide easy to read examples of how to use DataSnap features.

The server and client are included in this project. Normally these would be in separate projects and executed in separate processes. The client and server are combined into the same project and execute in the same process for the purpose of providing a simple example. Units that would normally execute in a server process have Server in their name. Units that would normally execute in a client process have Client in their name.

  1. Navigate to Start | Programs | Embarcadero RAD Studio Alexandria | Samples and go to Object Pascal\DataSnap\Basic\Examples.
  2. Open the DataSnapExamples.dproj project inside the same project group as the Server.
  3. Build the DataSnapExamples.dproj project.
  4. Run the application by clicking Run > Run in the IDE or by pressing F9. Make sure you have the DataSnapExamples.dproj project selected in the Project Group.

Files

The files used by this sample are:

Server Files

File Contains

DataSnapTestServer

The Basic DataSnap Server project.

MethodsServerModule

The DataSnap Server module.

ParametersServerModule

The parameters Server module.

ProviderServerModule

The provider Server module.

ServerContainerForm

The main form that is the user interface for the Basic DataSnap Server application.

Client Files

File Contains

ClientClasses

Client classes created by the DataSnap proxy generator.

ClientForm

The main form that is the user interface for the Basic DataSnap Client application.

DataSnapTestClient

The Basic DataSnap Client project.

DataSnap Server Methods Example Files

File Contains

This client is a collection of dunit tests.

Client classes created by the DataSnap proxy generator.

ClientTestClasses

Client test classes created by the DataSnap proxy generator.

DataSnapExamples

The Basic DataSnap Server Methods Example project.

DataSnapTestData

Various methods and classes used in the testing process.

TestServerContainer

The DataSnap server container.

TestServerModule

The DataSnap server module.

Uses

See Also