Saltar para o conteúdo principal
Versão: v20 R4 BETA

Client/Server Management

As aplicações 4D desktop podem ser utilizadas numa configuração Cliente/Servidor, quer como aplicações cliente/servidor fundidas, quer como projectos remotos.

  • merged client/server applications are generated by the Build Application manager. São utilizados para implementações de aplicações.

  • Os projectos remotos são ficheiros .4DProject abertos pelo 4D Server e acedidos com 4D em modo remoto. O servidor envia uma versão .4dz do projecto (formato comprimido) para o 4D remoto, assim os ficheiros de estrutura são apenas de leitura. Esta configuração é normalmente utilizada para testar aplicações.

Connecting to a remote projet from the same machine as 4D Server allows modifying the project files. This specific feature allows to develop a client/server application in the same context as the deployment context.

Abrir uma aplicação cliente/servidor fundida

A merged client/server application is customized and its starting is simplified:

  • Para iniciar a parte do servidor, o usuário simplesmente clica duas vezes no aplicativo do servidor. The database does not need to be selected.
  • Para iniciar a parte do cliente, o usuário simplesmente clica duas vezes no aplicativo cliente, que se conecta diretamente ao aplicativo do servidor.

These principles are detailed in the Build Application page.

Abrir um projecto remoto

A primeira vez que se liga a um projecto 4D Server através de um 4D remoto, normalmente utilizará o diálogo de ligação padrão. Thereafter, you will be able to connect directly using the Open Recent Projects menu or a 4DLink shortcut file.

Para conectar remotamente a um projeto 4D Server:

  1. Faça uma das seguintes opções:
    • Sélectionnez Se connecter à 4D Server dans la boîte de dialogue de l'Assistant de bienvenue
    • Select Connect to 4D Server in the Welcome Wizard dialog, OR Select Open/Remote Project... from the File menu or the Open toolbar button.

Aparece o diálogo de ligação do 4D Server. This dialog has three tabs: Recent, Available, and Custom.

If 4D Server is connected to the same network as the remote 4D, select Available. 4D Server includes a built-in TCP/IP broadcasting system that, by default, publishes the name of the 4D Server projects available over the network. A lista é classificada por ordem de aparecimento e atualizada dinamicamente.

To connect to a server from the list, double-click on its name or select it and click the OK button.

A circumflex accent (^) is placed before the name of projects published with the encryption option enabled.

If the published project is not displayed in the Available list, select Custom. The Custom page allows you to connect to a published server on the network using its network address and assigning it a customized name.

  • Project name: Defines the local name of the 4D Server project. This name will be used in the Recent page when referring to the project.
  • Network address: The IP address of the machine where the 4D Server was launched.
    • If two servers are executed simultaneously on the same machine, the IP address must be followed by a colon and port number, for example: 192.168.92.104:19814.
    • Por padrão, a porta de publicação de um 4D Server é 19813. Este número pode ser modificado nas definições do Projecto.

The Activate development mode option opens the remote connection in a special read/write mode and requires to access the project folder from the remote 4D (compatibility option).

Once this page assigns a server, clicking the OK button will allow you to connect to the server.

Once a connection to the server has been established, the remote project will be listed on the Recent tab.

Atualizar ficheiros de projeto no servidor

4D Server automatically creates and sends the remote machines a .4dz version of the .4DProject project file (not compressed) in interpreted mode.

  • An updated .4dz version of the project is automatically produced when necessary, i.e. when the project has been modified and reloaded by 4D Server. O projecto é recarregado:
    • automatically, when the 4D Server application window comes to the front of the OS or when the 4D application on the same machine saves a modification (see below).
    • quando o comando RELOAD PROJECT é executado. Calling this command is necessary for example when you have pulled a new version of the project from the source control platform.

Atualizar ficheiros de projeto em máquinas remotas

When an updated .4dz version of the project has been produced on 4D Server, connected remote 4D machines must log out and reconnect to 4D Server in order to benefit from the updated version.

Utilização de 4D e 4D Server na mesma máquina

When 4D connects to a 4D Server on the same machine, the application behaves as 4D in single user mode and the design environment allows you to edit project files. This feature allows you to develop a client/server application in the same context as the deployment context.

When 4D connects to a 4D Server on the same machine, the development mode is automatically activated, whatever the opening option status.

Each time 4D performs a Save all action from the design environment (explicitly from File menu or implicitly by switching to application mode for example), 4D Server synchronously reloads project files. 4D waits for 4D Server to finish reloading the project files before it continues.

However, you need to pay attention to the following behavior differences compared to standard project architecture:

  • the userPreferences.{username} folder used by 4D is not the same folder used by 4D Server in the project folder. Instead, it is a dedicated folder, named "userPreferences", stored in the project system folder (i.e., the same location as when opening a .4dz project).
  • the folder used by 4D for derived data is not the folder named "DerivedData" in the project folder. Instead it is a dedicated folder named "DerivedDataRemote" located in the project system folder.
  • o ficheiro catalog.4DCatalog não é editado por 4D, mas pelo 4D Server. As informações do catálogo são sincronizadas através de pedidos cliente/servidor
  • o ficheiro directory.json não é editado por 4D, mas pelo 4D Server. As informações do diretório são sincronizadas através de pedidos cliente/servidor
  • 4D utiliza os seus próprios componentes internos e plug-ins em vez dos do 4D Server.

Não é recomendado instalar plug-ins ou componentes no nível da aplicação 4D, ou 4D Server.