An overview of basic ASTA component interaction
The abstract diagram below demonstrates the basic interaction between the three most important ASTA components; AstaClientDataSet, AstaClientSocket and AstaServerSocket. The diagram will also help to distill some simple rules. (This diagram is not the only implementation possible. In fact, the components are extremely flexible and can be deployed in many configurations. For introductory and instructional purposes, however, we will discuss "typical" or "most likely" implementations as represented in the diagram below.)
Visual Key to the components
The AstaClientDataSet is the key component in the architecture.
It descends from the VCL's TDataSet object. In essence, the AstaClientDataSet is a hybrid TTable-TQuery-TUpdateSQL
component that resides in memory. Since it is loaded into memory, access to records in the AstaClientDataSet
is extremely fast. If you need persistence, the dataset can be streamed to a file and then loaded from
the file. You point a TDataSource component to the AstaClientDataSet in the same way that you would point
a TDataSource to a TTable or TQuery.
The AstaClientSocket is the component that connects the client to the AstaServer
It descends from a combination of the VCL's socket objects. The AstaClientSocket
is the client end of the "pipe". All data sent to or from the application passes through this
component. The AstaClientSocket's Address and Port properties need to match the server's Address and
Port properties (the Host and Port properties can be used if you are using the Domain Naming System [DNS]).
The AstaClientSocket, is also a place where "global" characteristics can be assigned to the client piece of the application. If you wish to use compression or encryption, for instance, you would set those at the AstaClientSocket.
The AstaServerSocket is the AstaServer component that accepts the connections from the AstaClients. It descends from the VCL's socket objects. The AstaServerSocket is the center control of the application server. It manages who is connected and which messages they are receiving. Every message in an AstaServer flows through the AstaServerSocket.
This diagram illustrates how the components are distributed between the client and server tiers.
AstaClients are normally comprised of an AstaClientSocket and at least one AstaClientDataSet. The AstaClientSocket is in charge of "speaking" to the AstaServer or, more specifically, to the AstaServerSocket.
The AstaClientDataSet is the TDataSet descendant. It is an in-memory dataset that frees you from the BDE. The AstaClientDataSet functions like a hybrid TTable-TQuery-TUpdateSQL component. You point a TDataSource to the AstaClientDataSet and then you connect your normal data-aware controls to the TDataSource.
An AstaServerSocket is the core component of an ASTA server. The ASTA server is the "application server" or "middle tier". It manages all the client connections and simultaneously speaks to the database (via regular database controls) as necessary. As depicted in the diagram, the ASTA server easily speaks to BDE or ODBC data sources. Although not depicted in the diagram, the ASTA server can be made to speak to other data sources as well. In fact, if you are willing to write an interface, the ASTA server can be hooked up to anything you can think of. Not just databases, but process control or custom-made equipment.