Please consider registering

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
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
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
Jouni Aro
Forum Posts: 914
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: 267

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 111

pramanj: 86

ibrahim: 74

kapsl: 57

gjevremovic: 49

Xavier: 42

TimK: 41

fred: 41

Fransua33: 39

rocket science: 36

Member Stats:

Guest Posters: 0

Members: 1590

Moderators: 17

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1192

Posts: 5057

Newest Members:

warnerfleming, Raymond23Freex, Charles1UsadY, Robertvem, albertinaduff53, wilbertrignall, Rogerbeedo, letamunn4183992, Lizazooda, Hectorner

Moderators: Jouni Aro: 914, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 695, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 24, Teppo Uimonen: 21, Markus Johansson: 36, Niklas Nurminen: 0, Matti Siponen: 161, Lusetti: 0

Administrators: admin: 1