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: 1027
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: 1919

Currently Online:
60 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: 793

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1538

Posts: 6493

Newest Members:

sophiadavis, Waynegalse, Phillipbus, Oscarsat, WilliamJer, WilliamTunse, mvsjonah79, RaymondSmutt, Merlin AI pap, patlawrence98

Moderators: Jouni Aro: 1027, Pyry: 1, Petri: 0, Bjarne Boström: 1037, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0

Administrators: admin: 1