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, EET
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, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
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, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
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, EET
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, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
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, EET
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: 1919

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1