Skip to content

Commit

Permalink
in example code: set explicitly endpoint, wait for user to stop process
Browse files Browse the repository at this point in the history
  • Loading branch information
oroulet committed Jun 19, 2014
1 parent eeb4c06 commit 84d7502
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions exe/src/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
///
#include <iostream>
#include <algorithm>
#include <time.h>

#include <thread>
#include <chrono>

#include <opc/common/application.h>
#include <opc/common/addons_core/config_file.h>
#include <opc/ua/node.h>

#include <opc/ua/opcuaserver.h>
Expand All @@ -28,6 +30,7 @@ int main(int argc, char** argv)
try
{
server.SetLoadCppAddressSpace(true);
server.SetEndpoint("opc.tcp://localhost:4841");
//server.AddAddressSpace("standard_address_space.xml");
//server.AddAddressSpace("user_address_space.xml");
server.Start();
Expand All @@ -42,6 +45,12 @@ int main(int argc, char** argv)
QualifiedName qn("NewObject", 2);
root.AddObject(nid, qn);

std::cout << "Ctrl-C to exit" << std::endl;
for(;;)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}

}
catch (const std::exception& exc)
{
Expand Down

0 comments on commit 84d7502

Please sign in to comment.