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

Method open_secure_channel

opcua/client/ua_client.py:193–212  ·  view source on GitHub ↗
(self, params)

Source from the content-addressed store, hash-verified

191 return ack
192
193 def open_secure_channel(self, params):
194 self.logger.info("open_secure_channel")
195 request = ua.OpenSecureChannelRequest()
196 request.Parameters = params
197
198 # use callback to make sure channel security parameters are set immedialty
199 # and we do no get race conditions
200 def clb(future):
201 response = struct_from_binary(ua.OpenSecureChannelResponse, future.result())
202 response.ResponseHeader.ServiceResult.check()
203 self._connection.set_channel(response.Parameters, params.RequestType, params.ClientNonce)
204 clb.future.set_result(response)
205 clb.future = Future() # hack to have a variable only shared between a callback and us
206
207 self._send_request(request, message_type=ua.MessageType.SecureOpen, callback=clb)
208 # wait for our callbackto finish rexecuting before returning
209 response = clb.future.result(self.timeout)
210 response.ResponseHeader.ServiceResult.check()
211
212 return response.Parameters
213
214 def close_secure_channel(self):
215 """

Callers

nothing calls this directly

Calls 2

_send_requestMethod · 0.95
checkMethod · 0.80

Tested by

no test coverage detected