コード例 #1
0
ファイル: client.py プロジェクト: mellgit/python-practice
from opcua import Client  # module for working with a client
import time
import os

ip_port = input('enter "ip:port">')
try:
    protocol = "opc.tcp://"
    url = str(protocol + ip_port)  # server address

    client = Client(url)  # customer creation
    client.connect_socket()
    client.send_hello()
    client.open_secure_channel()
    client.create_session()

    parameters = [
        client.get_endpoints()[0].Server.ProductUri,
        client.get_endpoints()[0].Server.ApplicationUri,
        client.get_endpoints()[0].Server.ApplicationName,
        client.get_endpoints()[0].Server.ApplicationType,
        client.get_endpoints()[0].Server.GatewayServerUri,
        client.get_endpoints()[0].Server.DiscoveryProfileUri,
        client.get_endpoints()[0].Server.DiscoveryUrls
    ]

    keys = [
        "ProductUri",
        "ApplicationUri",
        "ApplicationName",
        "ApplicationType",
        "GatewayServerUri",