MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / _send_request

Method _send_request

opcua/client/ua_client.py:45–73  ·  view source on GitHub ↗

send request to server, lower-level method timeout is the timeout written in ua header returns future

(self, request, callback=None, timeout=1000, message_type=ua.MessageType.SecureMessage)

Source from the content-addressed store, hash-verified

43 self._thread.start()
44
45 def _send_request(self, request, callback=None, timeout=1000, message_type=ua.MessageType.SecureMessage):
46 """
47 send request to server, lower-level method
48 timeout is the timeout written in ua header
49 returns future
50 """
51 with self._lock:
52 request.RequestHeader = self._create_request_header(timeout)
53 self.logger.debug("Sending: %s", request)
54 try:
55 binreq = struct_to_binary(request)
56 except Exception:
57 # reset reqeust handle if any error
58 # see self._create_request_header
59 self._request_handle -= 1
60 raise
61 self._request_id += 1
62 future = Future()
63 if callback:
64 future.add_done_callback(callback)
65 self._callbackmap[self._request_id] = future
66
67 # Change to the new security token if the connection has been renewed.
68 if self._connection.next_security_token.TokenId != 0:
69 self._connection.revolve_tokens()
70
71 msg = self._connection.message_to_binary(binreq, message_type=message_type, request_id=self._request_id)
72 self._socket.write(msg)
73 return future
74
75 def send_request(self, request, callback=None, timeout=1000, message_type=ua.MessageType.SecureMessage):
76 """

Callers 3

send_requestMethod · 0.95
open_secure_channelMethod · 0.95
close_secure_channelMethod · 0.95

Calls 5

struct_to_binaryFunction · 0.90
revolve_tokensMethod · 0.80
message_to_binaryMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected