Commit 02b764c9 authored by Daniel B's avatar Daniel B Committed by oroulet

Added properties to configure MaxMessageSize and MaxChunkCount (#517)

* Added properties to configure MaxMessageSize and MaxChunkCount

* improved properties to configure MaxMessageSize and MaxChunkCount
parent 53fd8d52
......@@ -114,6 +114,9 @@ class Client(object):
self._session_counter = 1
self.keepalive = None
self.nodes = Shortcuts(self.uaclient)
self.max_messagesize = 0 # No limits
self.max_chunkcount = 0 # No limits
def __enter__(self):
self.connect()
......@@ -146,7 +149,7 @@ class Client(object):
Set user password for the connection.
initial password from the URL will be overwritten
"""
self._password = pwd
self._password = pwd
def set_security_string(self, string):
"""
......@@ -270,7 +273,7 @@ class Client(object):
"""
Send OPC-UA hello to server
"""
ack = self.uaclient.send_hello(self.server_url.geturl())
ack = self.uaclient.send_hello(self.server_url.geturl(), self.max_messagesize, self.max_chunkcount)
# FIXME check ack
def open_secure_channel(self, renew=False):
......
......@@ -144,9 +144,11 @@ class UASocketClient(object):
self._socket.socket.shutdown(socket.SHUT_RDWR)
self._socket.socket.close()
def send_hello(self, url):
def send_hello(self, url, max_messagesize = 0, max_chunkcount = 0):
hello = ua.Hello()
hello.EndpointUrl = url
hello.MaxMessageSize = max_messagesize
hello.MaxChunkCount = max_chunkcount
future = Future()
with self._lock:
self._callbackmap[0] = future
......@@ -218,8 +220,8 @@ class UaClient(object):
def disconnect_socket(self):
return self._uasocket.disconnect_socket()
def send_hello(self, url):
return self._uasocket.send_hello(url)
def send_hello(self, url, max_messagesize = 0, max_chunkcount = 0):
return self._uasocket.send_hello(url, max_messagesize, max_chunkcount)
def open_secure_channel(self, params):
return self._uasocket.open_secure_channel(params)
......
......@@ -17,8 +17,8 @@ class Hello(uatypes.FrozenClass):
self.ProtocolVersion = 0
self.ReceiveBufferSize = 65536
self.SendBufferSize = 65536
self.MaxMessageSize = 0
self.MaxChunkCount = 0
self.MaxMessageSize = 0 # No limits
self.MaxChunkCount = 0 # No limits
self.EndpointUrl = ""
self._freeze = True
......
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