Skip to content

Latest commit

 

History

History
 
 

example-client

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Example CoAP client

This is an example coap client application, that can be use with any LwM2M Server.

Usage

./run.sh [-k KEYSTORE_FILE] [-s SSL_PROVIDER] <scheme>://<registration-url>

Schemes

  • coap:// (RFC 7252)
  • coaps:// (RFC 7252)
  • coap+tcp:// (RFC 8323)
  • coaps+tcp:// (RFC 8323)

Examples

./run.sh 'coap://localhost:5683/rd?ep=device007&lt=3600&b=U'    

Running with openssl:

./run.sh -k device01.jks -s openssl 'coaps://localhost:5684/rd?ep=device001'

Note:

This requires openssl version that supports dtls. Use environment variable COAPCLI_OPENSSL to point to specific location of openssl binary.

For example: export COAPCLI_OPENSSL=/usr/local/opt/[email protected]/bin/openssl

Running with standard io (bidirectional pipe):

mkfifo fifo
./run.sh -s stdio "coaps://127.0.0.1:5683/rd?ep=test&aid=dm&lt=60" < fifo | \
socat -d -d - udp-sendto:localhost:5683 > fifo

or

./run.sh -s stdio "coaps://127.0.0.1:5683/rd?ep=test&aid=dm&lt=60" < fifo | \
openssl s_client -connect localhost:5684 -cipher PSK-AES128-CBC-SHA -psk 01010101010101010101010101010101 -psk_identity device-0000000001  -quiet > fifo

Build distribution (zip)

./gradlew example-client:distZip