Commit ab8950de authored by yogesh.m's avatar yogesh.m

update

parent 9c79907c
...@@ -38,7 +38,6 @@ async def create_node_hierarchy(client, node_objects): ...@@ -38,7 +38,6 @@ async def create_node_hierarchy(client, node_objects):
async def get_send_hash(ENDPOINT,NAMESPACE,server_hash_udp_ip,server_hash_udp_port): async def get_send_hash(ENDPOINT,NAMESPACE,server_hash_udp_ip,server_hash_udp_port):
global nm_no global nm_no
serverAddressPort = (server_hash_udp_ip, server_hash_udp_port) serverAddressPort = (server_hash_udp_ip, server_hash_udp_port)
bufferSize = 1024
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
async with Client(url=ENDPOINT) as client: async with Client(url=ENDPOINT) as client:
nm_no=await client.get_namespace_index(NAMESPACE) nm_no=await client.get_namespace_index(NAMESPACE)
......
...@@ -60,6 +60,7 @@ async def get_nodes(client,node_objects): ...@@ -60,6 +60,7 @@ async def get_nodes(client,node_objects):
async def main() -> None: async def main() -> None:
global nm_no global nm_no
try:
async with Client(url=ENDPOINT) as client: async with Client(url=ENDPOINT) as client:
nm_no = str(await client.get_namespace_index(NAMESPACE)) nm_no = str(await client.get_namespace_index(NAMESPACE))
object_root_node = client.get_objects_node() object_root_node = client.get_objects_node()
...@@ -73,6 +74,8 @@ async def main() -> None: ...@@ -73,6 +74,8 @@ async def main() -> None:
while True: while True:
await handler.process() await handler.process()
await asyncio.sleep(0.01) await asyncio.sleep(0.01)
except:
print("No connection found for opcua server, check if the server is active")
if __name__ == '__main__': if __name__ == '__main__':
asyncio.run(main()) asyncio.run(main())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment