Avatar
Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
Run OPC in a Thread
June 16, 2012
6:49, EEST
Avatar
Rainer Versteeg
Member
Members
Forum Posts: 32
Member Since:
March 21, 2012
sp_UserOfflineSmall Offline

Hello !

Is it possible to create a OPCServer in A Thread ?

At the moment I initialize the OPC Server in the Inalization of a Class

initialization
coInitializeSecurity(NIL, -1, NIL, NIL, RPC_C_AUTHN_LEVEL_NONE,
RPC_C_IMP_LEVEL_IDENTIFY, NIL, EOAC_NONE, NIL);
OPCProvider := TPSOPCProvider.Create;
with OPCProvider do
begin
Autorun := true;
CLSID := ‘{4F3F0F22-36A7-4EBD-A717-D930B440F139}’;
Servername := ‘DEMiC_OPC_SERVER_V100’;
Description := ‘DEMiC OPC Server V1.00’;
Vendor := ‘DEMiC Datentechnik GmbH’;
VendorInfo := ”;
AddressSpace.IncludeProps := true;
Version := 0;
ThreadingModel := tmboth; // Default = tmBoth
ActivityLog.Active := false;
ActivityLog.MaxLines := 500;
ActivityLog.FileName := ‘Activity.log’;
OnItemAccessRights := cls_opcserver.OPCProviderItemAccessRights;
Initialize;
end;

Now i want call the above initalization in a Thread

procedure OPCThread.Execute;
begin
coInitializeex(nil, COINIT_MULTITHREADED);
While not terminated do
begin
//Inital OPC Server
end;
CoUninitialize;

Br,
Rainer

end;

June 18, 2012
7:53, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1029
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

No, the OPCProvider must be defined in the application initialization part.

It will use the standard COM server mechanisms of Delphi and actually uses internal threads to manage the incoming calls from clients.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 24
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 90
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 733
Moderators: 8
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1545
Posts: 6516
Newest Members:
basilpullman, Richardmip, mood edibles, LouieWreve, daniellabdx, janessan21, sammiebeak359, gena7127517, thorstenbouldin, Brett.Rollason
Moderators: Jouni Aro: 1029, Pyry: 1, Petri: 1, Bjarne Boström: 1045, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0, Elias: 0
Administrators: admin: 1