Commit e20ef7a3 authored by Philipp's avatar Philipp

Update opcua-server-fhi /minimal-server.py

parent 14afa67e
...@@ -17,7 +17,6 @@ a('--ipv6', help='The IPv6 address on which the OPCUA Server runs', default="::" ...@@ -17,7 +17,6 @@ a('--ipv6', help='The IPv6 address on which the OPCUA Server runs', default="::"
a('--ipv6-enabled', help='The IPv6 address check whether it is enabled or disabled', default="1") a('--ipv6-enabled', help='The IPv6 address check whether it is enabled or disabled', default="1")
a('--port', help='The port on which the OPCUA Server runs', default="4840") a('--port', help='The port on which the OPCUA Server runs', default="4840")
args = parser.parse_args() args = parser.parse_args()
# ipv4 = args.ipv4
ipv6 = args.ipv6 ipv6 = args.ipv6
ipv6_enabled = args.ipv6_enabled ipv6_enabled = args.ipv6_enabled
port = args.port port = args.port
...@@ -32,7 +31,10 @@ async def main(): ...@@ -32,7 +31,10 @@ async def main():
# setup our server # setup our server
server = Server() server = Server()
await server.init() await server.init()
server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/")
if bool(int(ipv6_enabled)):
server.set_endpoint(f"opc.tcp://[{ipv6}]:{port}/freeopcua/server/")
# set up our own namespace, not really necessary but should as spec # set up our own namespace, not really necessary but should as spec
uri = "http://examples.freeopcua.github.io" uri = "http://examples.freeopcua.github.io"
idx = await server.register_namespace(uri) idx = await server.register_namespace(uri)
......
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