Code Monkey home page Code Monkey logo

coap's Introduction

CoAP: Constrained Application Protocol (RFC 7252)

This coap repository is based on master branch @b425b150 commit of libcoap.
For further information related to CoAP, see http://coap.technology.

How to Use in rt-thread

1 Get CoAP Package

CoAP package Path in menuconfig :
RT-Thread online packages/IoT/CoAP.

2 Open MSH Support

Config in menuconfig :
RT-Thread Components/Command shell/Using mode shell

Modify MSH consle buffer in menuconfig :
Set RT-Thread Kernel/Kernel Device Object/the buffer size for console log printf as 512

3 Compile and Download

If there are some errors after compiled , please refer to the following Notes

4 Run Example

Use coap_client to request coap.me/test

4.1 coap client example

Using -m param to select coap client request method , it only realize get method.

msh />coap_client -m get coap://coap.me/test
uri.path.s = test; uri.host.s = coap.me/test 
server_host = coap.me
DNS lookup succeeded. IP=134.102.218.18
welcome to the ETSI plugtest! last change: 2018-01-15 13:55:19 UTC

4.2 coap server example

msh />coap_server 

Default coap server uri is coap://yourserveripaddr/rtthread , use another coap_client to request this server as coap_client -m get coap://yourserveripaddr/rtthread , then client will return Hello rtthread! message.

Notes

1 strings.h no define problem

Modify libcoap/include/coap/encode.h at line 13 as #if (BSD >= 199103) || defined(WITH_CONTIKI) || defined(RTTHREAD_VERSION)

2 sys/select.h or sys/socket.h can't found problem

Config in menuconfig :
Don't select RT-Thread Component/Device virtual file system/Enable BSD socket/Toolchain sys/select.h and Toolchain sys/socket.h.

3 FD_SETSIZE too small problem

Config in menuconfig :
The RT-Thread Component/Device virtual file system/The maximal number of opened files value need to greater or equal to RT-Thread Component/Network stack/light weight TCP/IP stack/The number of raw connection value.

Reference

1 CoAP Official website: http://coap.technology/
2 CoAP test server: coap.me

coap's People

Contributors

armink avatar bernardxiong avatar lawlieta avatar murphyzhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

coap's Issues

编译出错

RT-Thread开启coap协议,编译出现一大推错误

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.