Instance learning distributed development

xiaoxiao2021-03-06  45

Author: Guo Baoli Source: Original Date: 2004.07.11 should be developed two applications, one is to do a server, a client is doing. First introduce the program of the server. Server programs usually package business logic, no interface processing, for client calls. For example, we create an additional server. The steps are as follows: 1. Write the script for the ConnectionBegin for the Application object. This event is triggered when the client program is trying to join the server. Therefore, the event should check the legality of the user. If it is a legal user, returns the joint success mark. The script is as follows: if userid = 'Guobaoli' Ten Return ConnectPrivilege! 2 Open the server main window in the Application event. Open (w_main) 3 Sets the necessary parameters for Transport in the OPEN event of the W_MAIN window. All and client processing are performed by this object. So, first need to define a global variable g_transport of a Transport type. Then write the following script: integer li_rtn g_transport = Create TransPort g_transport.Driver = 'WinSock' // driver g_transport.Application = '5555' // port number li_rtn = g_TransPort.Listen () // links monitor client if li_rtn <> 0 Then Halt Close 4, this is the most important step, developing business logic, must be a non-visible user object. We only write a function of_add. / * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- * Function definition: Integer of_add (Integer Ai_1, Integer Ai_2) * Function: Squiration. * Write the date: 2004.7.11 * Writer: Da Tongxing Computer Technology Guo Baoli * -------------------------------- ----------------------------------- / Return Ai_1 AI_2 5, after the business logic is completed, in order to Ensure that the client can call the functions in these user objects, requiring the client's agent. If the client passes these agents, you can know which functions are on the server. So, our steps need to create a client agent. The steps are as follows: 1) Turn off all the open discord panels in the PB. Select the user object; 4) Select Properties in the toolbar, select Output Library to the client's PBL (if not created, you can create client PBL); 5) Run, you can generate a client agent. At this point, the processing of the server-side program is over. The client's program is written below. First open the main window in the OPEN event of the Application object: Open (w_main) then, we design the main window.

转载请注明原文地址:https://www.9cbs.com/read-73999.html

New Post(0)