tutorial_client_firstSteps.rst 1.0 KB

1234567891011121314151617181920212223242526272829
  1. Building a simple client
  2. ------------------------
  3. You should already have a basic server from the previous tutorials. open62541
  4. provides both a server- and clientside API, so creating a client is as easy as
  5. creating a server. Copy the following into a file `myClient.c`:
  6. .. literalinclude:: client_firstSteps.c
  7. :language: c
  8. :linenos:
  9. :lines: 4,5,14,17-
  10. Compilation is similar to the server example.
  11. .. code-block:: bash
  12. $ gcc -std=c99 open6251.c myClient.c -o myClient
  13. Further tasks
  14. ^^^^^^^^^^^^^
  15. * Try to connect to some other OPC UA server by changing
  16. ``opc.tcp://localhost:16664`` to an appropriate address (remember that the
  17. queried node is contained in any OPC UA server).
  18. * Try to set the value of the variable node (ns=1,i="the.answer") containing an
  19. ``Int32`` from the example server (which is built in
  20. :doc:`tutorial_server_firstSteps`) using "UA_Client_write" function. The
  21. example server needs some more modifications, i.e., changing request types.
  22. The answer can be found in "examples/exampleClient.c".