Development of distributed application in PB environment

Source: Internet
Author: User
Tags port number

Overview of Distributed Applications

The emergence of distributed system originates from some disadvantages of traditional C/s structure, such as inefficient, poor security, combined with the database, the global DNS (domain name resolution System) system is a very typical example, imagine if all the world's domain names are centralized to a server to manage, The server is bound to be overloaded and will not work, and the entire internet is paralyzed.

When compiling the database application System of C/s structure, also encounter such problems, that is, if the number of customers, the data volume is very large, the server load will be heavy, and repetitive work a lot, because many customers may send the query is identical and the server needs to query While the query algorithm is stored on the client, this may not be appropriate for some business environment, because the algorithm itself may need to be kept secret. If you can add a server between a traditional server and a client to store the query algorithm and the results of a temporary query, the above problems are resolved. This is how the distributed system works.

Ii. How to develop distributed application in PB environment

The diagram below is a working schematic diagram of a distributed system:

Figure (i)

First of all, the distributed server must establish a connection with the database server, can be implemented through the ODBC interface, this article is not described, the following to describe how the client through the distributed server to access data.

In the PB environment to achieve distributed programming, first in the DTS end, need to use two objects, a transport object and a User object (Classàcustom,nonvisible object, hereinafter referred to as NVO), Where the transport object is used in response to a client's connection request, the Nvo object is used for actual data transfer with the client. The client also needs to use two objects, namely the connection object and the proxy object (Nvo-proxy), where the connection object is used to establish the connection to DTS, Nvo-proxy is actually corresponding to nvo one by one, it is only a proxy for NVO, This proxy object is invoked by the client to invoke the NVO function to implement the related functionality.
The following are common properties and methods for transport objects and connection objects:

1, Transport object

Property:

Driver: There are four optional values, namely, Winsock, Namedpipes, Openclientserver and local, Winsock is generally chosen because of the universality of the Winsock.

Application: For Winsock, it refers to the port number, which the user can specify arbitrarily, but must be greater than 4096.

Method:

Listen (): Its invocation method is transport. Listen (), which starts listening, returns 0 if the call succeeds.

Stoplistening (): Its invocation method is transport. Stoplistening (), which ends the listener, returns 0 if the call succeeds.

2, Connection object

Property:

Driver: Same as transport object

Application: Same as the transport object, but be aware that both must be consistent.

IP address of the Location:dts

Method:

Connecttoserver (): Its invocation method is connection. Connecttoserver (), which connects DTS, returns 0 if the call succeeds, and it is clear that DTS must be listening before calling the function.

Disconnectserver (): Its invocation method is connection. Disconnectserver (), the connection to DTS is disconnected.

CreateInstance (): Its invocation method is connection. CreateInstance (variable), that is, to establish a NVO agent to invoke the related functions of nvo. Note Before calling this function, you must ensure that the client has established a connection with DTS.

For Nvo and Nvo-proxy objects, after the NVO is built in DTS, to set their proxy on the client, you can set up the local agent in DTS and then export the agent to the client. The specific settings are as follows: In the PB User Object artboard, click the right mouse on the user object, select "Set proxy name", enter the name of the proxy object with the disk, open PB Library artboard, find just save the agent object, click the right mouse and select "Export ..." Save this proxy object as a file, and then import the file to the client at the end. After import, the NVO function can be invoked on the client through this proxy object.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.