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
Reconnectnig to the OPC Server
September 1, 2015
9:38, EEST
Avatar
Fransua33
Member
Members
Forum Posts: 39
Member Since:
October 27, 2014
sp_UserOfflineSmall Offline

I have a Provider and a client. When I start the client all connections are OK. I can see the values and the value quality is good.

In the provider I disconnect the client. The disconnection proceed and the OnDisconnect event in the client fired. There I have a code to try to reconnect to the server and the code is executed but after all the displays box don’t refresh the values. Why?

I noticed that in the OnDisconnect event, the Connected property still true. I don’t understand why.

So I need to know how can I make the reconnection in the good way.

Thanks a lot for your support.

September 2, 2015
11:22, EEST
Avatar
Fransua33
Member
Members
Forum Posts: 39
Member Since:
October 27, 2014
sp_UserOfflineSmall Offline

I made some test and in the OnStateChange I test the state of the server and if it’s not running I reconnect.

This is OK when I disconnect the client from the provider, but not when I close my provider application. The client tries to connect in the OnStateChange and even if the state reflect a clear 0 state (no connection), the connect function of the TPsOPCServer object doesn’t fire any exception resulting for the client in a good connection. To prevent this behavior, in the OnShutdown event I try to reconnect with the same function but a DAX Error (Access violation at address 505680E2 in module ‘vcl170.bpl’ Read address 000002D8) appears and then the TPsOPCServer object can be used.

Is it normal that my TPsOPCServer can’t reconnect when the provider is shutdown (I ensured during the test that the provider was executed during the reconnection) ?

September 3, 2015
7:55, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I think the problem may be that while handling the events, you cannot make new calls to the server normally. This may be due to some COM limitations.

Also, when the server is closed and you call Connect from the client, it may restart the server.

I am not 100% certain of all behaviour in these scenarios, so you just need to experiment and find out how you get it working like you wish.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
10 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 680

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6259

Newest Members:

sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1