Re: simple coap client-server communication of two posix applications #coap


Jukka Rissanen
 

Hi Stefan,

I have had similar issues when zephyr tries to send data to host. In
all cases my firewall was blocking the connection. If this is the case
here, then just allow incoming packets from zeth. In Fedora, I just
mark the zeth as trusted interface in Firewall program.


Cheers,
Jukka

On Fri, 2020-02-28 at 01:19 -0800, Stefan Hristozov wrote:
Hi,
I want to set up a simple setup of two posix projects -- one running
a simple coap server and other running a simple coap client.

What I did so far:

1) I build both
/zephyrproject/zephyr/samples/net/sockets/coap_client and
zephyrproject/zephyr/samples/net/sockets/coap_server without any
changes.



2) I executed ./net-setup.sh. With sudo ifconfig I can see the new
zeth interface:
zeth: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.0.2.2 netmask 255.255.255.0 broadcast 0.0.0.0
inet6 2001:db8::2 prefixlen 128 scopeid 0x0<global>
ether 00:00:5e:00:53:ff txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0



3) I started the coap server posix program and tested it by sending a
get request to the core1 resource (I used the coap-cli tool
https://www.npmjs.com/package/coap-cli):

coap get coap://[2001:db8::1]/core1

to which the server replied with:

(2.05) Just a test

So the server works as expected. In addition I used wireshark
sniffing on the zeth interface --> The CoAP get request and the
response was there.



4)I started the client -- on the consol I see:

***** Booting Zephyr OS build v2.0.0-rc2 *****

CoAP client GET

but I cannot see any packets send in wireshark. I think something is
not properly configured probably the zeth interface?

How to test the coap_client sample when running it as a posix
application?

Best regards,
Stefan

Join users@lists.zephyrproject.org to automatically receive all group messages.