Avatar

Please consider registering
guest

sp_LogInOut Log In sp_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 RSS sp_TopicIcon
Problem connecting to remote OPC server
December 17, 2014
16:42, EEST
Avatar
Fransua33
Member
Members
Forum Posts: 39
Member Since:
October 27, 2014
sp_UserOfflineSmall Offline

I use the code above:

TPsOPCServer* opcServer = new TPsOPCServer(NULL);
opcServer->Connected = false;
opcServer->Host = “OPCSERVER”;
opcServer->ServerName = “TestServer.1”;
opcServer->Connect();

std::cout << "CONNECTED!!!" <<std::endl;
opcServer->Disconnect();

The problem is when I assign the ServerName value an EOleSysError occurs. This kind of error can’t be catch in a try block and I don’t know why it occurs.

When I try to connect se server, an EPsOPCError occur with the message:

OPC Error in method IConnectionPoint.Advise
Code: 0x80070005 (Access denied.)
Details: No more info available

With the visual component I never have this kind of exception or error. This code is inserted in a console project with C++ Builder XE3

December 18, 2014
8:42, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 853
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Your client computer cannot access the OPCEnum service in the remote host. This service is used to convert the ProgId of the server (ServerName) to CLSID. If you know the CLSID, you can use that instead.

But better is to make sure that the remote computer enables anonymous access to the OPCEnum COM Server, via DCOM Configuration.

December 18, 2014
8:44, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 853
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

The second error means that the server cannot initialise the callback connection back to the client computer, so you will also need to enable DCOM access to the client application (the server behaves as a client when using the callback interface in the client).

December 18, 2014
8:58, EEST
Avatar
Fransua33
Member
Members
Forum Posts: 39
Member Since:
October 27, 2014
sp_UserOfflineSmall Offline

I try with the ClassID and the same EOleSysError exception occurs.

With the Prosys Client and other clients I don’t have any problem. Also this problem is not present when I use the TPsOPCServer object in a windows application. So I think that a problem is there when using this object in a non windows application and also I don’t know why.

Also I can`t catch this exception and I don’t know why.

December 18, 2014
10:44, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 853
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hmm, OK, I did not understand that it’s a console application.

COM initialization is done differently, if you don’t have the Application instance as is the case with Windows applications

There are some instructions at (see the “For UI-less console applications” part at least)

http://www.techvanguards.com/s…..client.asp

although I am not sure how up to date that is in regard the modern Delphi releases (since the article is from 2002).

You will also need to process the windows message queue to get callbacks through – or just try to work with synchronous groups/connectors only.

All in all, I am not fully aware how to get the OPC client to work in a console application.

December 18, 2014
14:39, EEST
Avatar
Fransua33
Member
Members
Forum Posts: 39
Member Since:
October 27, 2014
sp_UserOfflineSmall Offline

In fact in a DLL, the application instance exists. So I still not understand why it’s not working correctly.

I think you might consider to try, as the software editor, to make a working sample of an OPC client DLL whith the Sentrol SDK.

If I archieve on correct solution, I will send you the code for tutorials purpose for the SDK.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
12 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1118

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1034

Posts: 4352

Newest Members:

aldayr, Python techie, emanuel45q, Patrick, sammycontrols, hellema, linoy, subranna, ray, richN9177

Moderators: Jouni Aro: 853, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 559, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 21, Markus Johansson: 24, Matti Siponen: 64, Lusetti: 0

Administrators: admin: 1