Using Delphi to establish communication and data Exchange Server-transceiver Technical analysis (next)

Source: Internet
Author: User

Second, transceiver service detailed

1. Transceiver Service Analysis Summary

Transceiver Service is the core of the transceiver system, transceiver kernel is responsible for reading the port, transceiver definition and parameters set by channel console from the System Configuration library, runtime dynamic creation and control of communication port and its associated relationship, data collection, distribution, buffer scheduling, log, queue management. The transceiver shell is the implementation of the port that is supported for all types of data sending and receiving.

2. Transceiver Service Design Overview

Transceiver Service is developed by Delphi Service Application, Service application can run in System state rather than user state, by operating system Service control Manager ( SCM) is responsible for the operation of the program management, service has no user interface, belong to the system background program. The transceiver kernel is a series of transceiver methods for establishing and controlling the transceiver shell, while the transceiver Shell is a collection of objects responsible for communication.

Note: Due to performance and load considerations, transceiver kernel only logically realizes the functional division of the shelves, and the component modules are not implemented in a completely object-oriented way.

3. Transceiver Service Implementation Overview

I. Establishment of a service application

Choose New| from Delphi main Menu file Other ... Select New| in the New Items dialog box that pops up Service application, you can see the resulting program framework as follows:

program Project1
uses
Svcmgr,
Unit1 in ' Unit1.pas ' {service1:tservice};
{$R *. RES}
Begin
Application.initialize
Application.createform (TService1, Service1);
Application.Run;
End.
Unit Unit1;
Interface
uses
Windows, Messages, Sysutils, Classes, Graphics, Controls, Svcmgr, Dialogs;
Type
Tservi Ce1 = Class (TService)
Private
{private declarations}
Public
function Getservicecontroller:tservicecont roller; Override
{public declarations}
end;
Var
Service1:tservice1
Implementation
{$R *. DFM}
Procedure ServiceController (Ctrlcode:dword); stdcall
begin
Service1.controller (ctrlcode);
End;
function TService1.GetServiceController:TServiceController;
Begin
Result: = ServiceController,
end,
end.

You can see that, in addition to referencing the Svcmgr for service management in the uses unit, TService1 inherits from Tserviced instead of Tform and an overloaded Getservicecontroller function and stdcall process that is invoked in ServiceController mode, With Delphi to establish a service program and not too much special, Delphi fans may also cheer, this is the strong charm of Delphi Rad. In addition, Service application because can not be directly in the Run-time debugging, there is no user interface, development should consider debugging information without interface output to facilitate debugging error.

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.