Skip to content
Snippets Groups Projects
Commit 5aa3ace7 authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Add variables for host and port

parent 9fa98f2f
No related branches found
No related tags found
No related merge requests found
test/Client.py 100644 → 100755
#! /usr/bin/env python3
import sys
import time
import logging
host = "localhost"
port = 62000
sys.path.insert(0, "..")
Temp_only = True
......@@ -57,7 +63,7 @@ if __name__ == "__main__":
# logger.setLevel(logging.DEBUG)
# client = Client("opc.tcp://LAPTOP-N0VQ3UDT:4840/")
client = Client("opc.tcp://192.168.137.102:4840/")
client = Client("opc.tcp://{}:{}/".format(host, port))
# client = Client("opc.tcp://169.254.91.66:4840/")
# I hope this is secure, because I have zero clue about security
# client.set_security_string("Basic256Sha256,SignAndEncrypt,certificate-example.der,private-key-example.pem")
......
#! /usr/bin/env python3
# this script connects to a server (specified in this file) and prints any debug messages the server has
# The server stores its most recent degug messages in a buffer. This client polls that buffer every 2 seconds
# The client checks for duplicates and prints any new debug messages.
......@@ -6,6 +8,10 @@
import sys
import time
import logging
host = "localhost"
port = 62000
sys.path.insert(0, "..")
from opcua import Client
......@@ -14,7 +20,7 @@ if __name__ == "__main__":
logging.basicConfig(level=logging.WARNING) #INFO ERROR WARNING NOTSET DEBUG
# for now, just connect to this client
client = Client("opc.tcp://192.168.137.102:4840/")
client = Client("opc.tcp://{}:{}/".format(host, port))
try:
# connect to client
......
#! /usr/bin/env python3
import signal
import sys
import time
import datetime
import logging
host = "localhost"
port = 62000
sys.path.insert(0, "..")
......@@ -101,9 +105,7 @@ if __name__ == "__main__":
# logger = logging.getLogger("KeepAlive")
# logger.setLevel(logging.DEBUG)
# client = Client("opc.tcp://LAPTOP-N0VQ3UDT:4840/")
client = Client("opc.tcp://192.168.137.102:4840/")
# client = Client("opc.tcp://169.254.91.66:4840/")
client = Client("opc.tcp://{}:{}/".format(host, port))
# I hope this is secure, because I have zero clue about security
# client.set_security_string("Basic256Sha256,SignAndEncrypt,certificate-example.der,private-key-example.pem")
......@@ -185,4 +187,3 @@ if __name__ == "__main__":
finally:
print(" disconnect")
client.disconnect()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment