FreeOpcUa / python-opcua

LGPL Pure Python OPC-UA Client and Server
http://freeopcua.github.io/
GNU Lesser General Public License v3.0
1.34k stars 660 forks source link

Not able to read the WinCC server state #1231

Closed rajnishnationfirst closed 3 years ago

rajnishnationfirst commented 3 years ago

Hi,

I am facing too much exceptions , like :

[WinError 10053] An established connection was aborted by the software in your host machine

I used to read the server state and accordingly take actions .

I am using the below code to get the server status :

Client URL:
hda_client = Client("opc.tcp://WINCCSERVERA:4862")

server=Server()
server.set_endpoint("opc.tcp://WINCCSERVERA:4862")
server_state_info = server.get_node("i=2256").get_data_value()
server_status = str(server_state_info.Value.Value.State)
print('Upper Blok',server_state_info, type(str(server_state_info)))

After i shut downt my WINCC SCADA , still i m getting the same status as State:ServerState.Running

How can i get my status correctly using free opcua.

Main idea is , my program should keep continuous running and check server state before every request and if server state is STOP , then not send requests and if connection is available then make request.

Pls help anyone .

Thanks and Regards

Rajnish Vishwakarma

AndreasHeine commented 3 years ago

[WinError 10053] An established connection was aborted by the software in your host machine

this error is not related to opcua library... keep in mind that opcua is client/server based request/response driven you need to rethink you programstrucutre!!!

https://github.com/FreeOpcUa/python-opcua/discussions https://github.com/FreeOpcUa/python-opcua/tree/master/examples https://reference.opcfoundation.org/v104/