Site Tools


Supported Examples

There are various examples in main project get inspirations from, but first you need the build sources for your favorite os or hardware.

Here are a couple of notes or hints to try your own

Note that for convenience some examples are using “experimental” API (not in public headers), so there is not guarantee those functions will be supported in future, so those internal headers are located in “experimental” subdirectories (like: utilities, logging…).


To test resource discovery.

There is a distinct client and server device, but it is possible to run both on the same machine.

You can try simpleserver/simpleclient as validation/demos examples, the pair is updating a simulated light.

To use them, you need to build from sources directory.

Then on linux os, you can run client/server pair this way (or in 2 terminals):

cd iotivity

TARGET_OS="linux" # or adapt
TARGET_ARCH="$(arch || echo unknown)" # or adapt
BUILD_MODE="debug" # or adapt to release

cd ${project_dir}/out/${TARGET_OS}/${TARGET_ARCH}/${BUILD_MODE}/resource/examples/
killall simpleserver simpleclient # make sure none are running

./simpleserver 2>&1 | tee simpleserver.log.txt &
./simpleclient 2>&1 | tee simpleclient.log.txt 

killall simpleserver # since simpleclient is over let's stop server too

Note about Security

make sure sure to start server in secured mode, using 2 arg, without resource won't be found (Error code 46 ) :

./simpleserver 2 2>&1 | tee simpleserver.log.txt &

Note, if security is enabled at build time (it is since 1.3-rel), it is important to have dat files in current work directory (without security example can be run from any place.)


On issues, enable logging features at build time, analyze logs, and ask support to community.

grep 'ERROR:' *.log 

If using yocto you can use this absolute path: /opt/iotivity/examples/resource/cpp/ and check some hints at:

For more technical details please read:

csdk examples

In iotivity/out/*/*/*/resource/csdk/stack/samples/linux/secure :


More details in resource_container page


cd ./out/linux/x86_64/release/service/resource-container/ 

LD_LIBRARY_PATH=.:../../  ./ContainerSample
          IoTivity Resource Container Test Application        
   1.  Start Resource Container                                 
   2.  Stop Resource Container                                  
   3.  Add Sample Bundle                                        
   4.  Start Sample Bundle                                      
   5.  Stop Sample Bundle                                       
   6.  Remove Sample Bundle                                     
   7.  Add Sample Resource                                      
   8.  Remove Sample Resource                                   
   9.  List Bundles                                             
   10. List Resources                                           
   11. Exit                                                     



It's a Java sample

Unsupported Examples

examples.txt · Last modified: 2018/10/11 12:09 by rzr