gopcua / opcua

Native Go OPC-UA library
MIT License
832 stars 253 forks source link

OPCUA server is disconnecting regulary #311

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi

I am trying to connect to a opc-ua server using python-opcua. The problem is, the client is getting shut down every now and then without communicating. How can I resolve this?

magiconair commented 4 years ago

Hard to tell without more info. What I have observed is that when I have a subscription without any update then the subscription times out and the client disconnects. My workaround is to subscribe to a node that always changes, e.g. the server time. On a Siemens PLC this is i=2258.

Kowiste commented 4 years ago

This is the opc for Go, I have your same problem and fix it using this option when create the client:

c := opcua.NewClient(EndPoint, opcua.SecurityMode(ua.MessageSecurityModeNone), opcua.SessionTimeout(0)) err := c.Connect(ctx))

Setting the SessionTimeout to zero.

axlev commented 3 years ago

Check out #396 - it will disconnect regularly as there is a problem when SecurityMode=MessageSecurityModeNone. I have a fix in a fork + open PR