Browse Source

fixing cxx example

Stasik0 10 years ago
parent
commit
5ebece8c79
1 changed files with 6 additions and 2 deletions
  1. 6 2
      examples/server.cpp

+ 6 - 2
examples/server.cpp

@@ -3,6 +3,7 @@
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  */
 #include <iostream>
+#include <cstring>
 
 #ifdef NOT_AMALGATED
 # include "ua_server.h"
@@ -22,10 +23,13 @@ using namespace std;
 
 int main()
 {
-	UA_Server *server = UA_Server_new(UA_ServerConfig_standard);
+    UA_Server *server = UA_Server_new(UA_ServerConfig_standard);
     UA_Server_addNetworkLayer(server, ServerNetworkLayerTCP_new(UA_ConnectionConfig_standard, 16664));
 
-	// add a variable node to the adresspace
+    UA_Logger logger = Logger_Stdout_new();
+    UA_Server_setLogger(server, logger);
+
+    // add a variable node to the adresspace
     UA_Variant *myIntegerVariant = UA_Variant_new();
     UA_Int32 myInteger = 42;
     UA_Variant_setScalarCopy(myIntegerVariant, &myInteger, &UA_TYPES[UA_TYPES_INT32]);