Skip to content
Advertisement

What is the terminal script to run CoAP server

Im trying to run this CoAP server from https://github.com/Tanganelli/CoAPthon on a raspberry pi. i cant seem to find much instructions. This was one of the CoAP that my instructor wanted us to use, my instructor pretty much left us hanging with no help at all but this link.

i followed the install instructions on the github page, the only thing that wouldnt install is the section

Install instructions for CoRE Resource Directory. Mongod wouldnt install for this section so i gave up. so i dont know if this section is important or not

What are the commands for the terminal to get it running and doing something.

it says to type in to run the server coapserver.py.

cd CoAPthon
python coapserver.py

and from what it looks like its running

but nothing happens, so im not sure if its just not working or if theres just nothing there for it to do, or if there is another file i need to run with the coapserver.py.

Im very new to using CoAP and will eventually need to add a sensor to it do record temp but i want to make sure i know the server is running properly before i add that part in

any input would be great

Advertisement

Answer

For future individuals that might need help with this, use aioCoAP, its much easier then CoAPthon

get it from here https://aiocoap.readthedocs.io/en/latest/installation.htmlg

all you need to do is mess with three files labeled server.py, clientPUT.py and clientGET.py Add resources and classes for sensors and what not to server.py ClientPUT.py is where you would add your code for the sensors or whatever you need. ClinetGET.py you alter the uri

run it by type in the command in the terminal (go to directory first that has the server) type in python server.py
in another terminal do the same thing but instead run python clientPUT.py

and the server should be running then all you need is a client for the get request. If you were like me and needed to use Copper go here to install it for chrome https://github.com/mkovatsc/Copper4Cr

Advertisement