Skip to content

ProtocolError: invalid data or unsupported protocol version #9

@vantaka2

Description

@vantaka2

I'm trying to connect to the Matrikon OPC Simulation server which is running on the same system.

my code:

import OpenOPC
OpenOPC.open_client('localhost')

The error:
ProtocolError: invalid data or unsupported protocol version

My packages:

OpenOPC-Python3x==1.2.2 ## (via pip install of https://pypi.org/project/OpenOPC-Python3x/)
Pyro4==4.74
serpent==1.27

and using python 3.7.0:

I believe this is a problem on the python side because I am able to connect and run commands using the command line client (opc.exe):
running:
opc -H localhost -h localhost -s Matrikon.OPC.Simulation -r Random.Int4
successfully yields
Random.Int4 32757 Good 12/10/18 19:24:24

Full error:
any idea why pyro4 is causing issues here?

ProtocolError                             Traceback (most recent call last)
<ipython-input-54-34e9043002f9> in <module>
----> 1 OpenOPC.open_client('localhost')

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\OpenOPC.py in open_client(host, port)
    129    import Pyro4.core
    130    server_obj = Pyro4.Proxy("PYRO:opc@{0}:{1}".format(host, port))
--> 131    return server_obj.create_client()
    132 
    133 class TimeoutError(Exception):

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in __getattr__(self, name)
    273             # get metadata if it's not there yet
    274             if not self._pyroMethods and not self._pyroAttrs:
--> 275                 self._pyroGetMetadata()
    276         if name in self._pyroAttrs:
    277             return self._pyroInvoke("__getattr__", (name,), None)

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in _pyroGetMetadata(self, objectId, known_metadata)
    613         if self._pyroConnection is None and not known_metadata:
    614             try:
--> 615                 self.__pyroCreateConnection()
    616             except errors.PyroError:
    617                 log.error("problem getting metadata: cannot connect")

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in __pyroCreateConnection(self, replaceUri, connected_socket)
    594                 self._pyroConnection = socketutil.SocketConnection(connected_socket, uri.object, True)
    595             else:
--> 596                 connect_and_handshake(conn)
    597             if config.METADATA:
    598                 # obtain metadata if this feature is enabled, and the metadata is not known yet

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in connect_and_handshake(conn)
    533                     _log_wiredata(log, "proxy connect sending", msg)
    534                 conn.send(msg.to_bytes())
--> 535                 msg = message.Message.recv(conn, [message.MSG_CONNECTOK, message.MSG_CONNECTFAIL], hmac_key=self._pyroHmacKey)
    536                 if config.LOGWIRE:
    537                     _log_wiredata(log, "proxy connect response received", msg)

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\message.py in recv(cls, connection, requiredMsgTypes, hmac_key)
    166         Validates a HMAC chunk if present.
    167         """
--> 168         msg = cls.from_header(connection.recv(cls.header_size))
    169         msg.hmac_key = hmac_key
    170         if 0 < config.MAX_MESSAGE_SIZE < (msg.data_size + msg.annotations_size):

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\message.py in from_header(cls, headerData)
    150         tag, ver, msg_type, flags, seq, data_size, serializer_id, anns_size, _, checksum = struct.unpack(cls.header_format, headerData)
    151         if tag != b"PYRO" or ver != constants.PROTOCOL_VERSION:
--> 152             raise errors.ProtocolError("invalid data or unsupported protocol version")
    153         if checksum != (msg_type + ver + data_size + anns_size + flags + serializer_id + seq + cls.checksum_magic) & 0xffff:
    154             raise errors.ProtocolError("header checksum mismatch")

ProtocolError: invalid data or unsupported protocol version`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions