Cloud COAP-Client TCP Issues

I'm building a COAP client using the Nordic nRF9160DK cloud coap-client example code as my base. I have the UDP version working great. But I'd like to convert to TCP.. I was hoping it would be a simple change to the socket just the addrinfo and socket creation calls, and turning off polling (since it's stream oriented) The first packet appears to send successfully. And the 2nd attempt always fails with a -128 error. I know COAP is more adapted to packet vs stream protocols. But I believe it is designed to work with either. Can you assist with resolving this issue. I will post some screenshots to show the mods I made for TCP.

Parents
  • Using CoAP over UDP is specified in RFC 7252, CoAP over TCP in RFC 8323. It uses different message formats (e.g removed MID, though the transmission is left to TCP, added length, which must be handled above TCP).

    AFAIK, libcoap offers a up-to-date implementation. If you want to test CoAP over TCP you will also require a server. eclipse/californium only offers a experimental implementation, which was never updated according the final RFC 8323. So that sandbox will hardly work, you need an other one.

    May I ask, why you try to use CoAP over TCP?

    In too many cases you lose the advantages of CoAP (less ip-messages, very efficient, very reliable, and with DTLS CID (upcoming RFC 9146 ) all that with true e2e security.

Reply
  • Using CoAP over UDP is specified in RFC 7252, CoAP over TCP in RFC 8323. It uses different message formats (e.g removed MID, though the transmission is left to TCP, added length, which must be handled above TCP).

    AFAIK, libcoap offers a up-to-date implementation. If you want to test CoAP over TCP you will also require a server. eclipse/californium only offers a experimental implementation, which was never updated according the final RFC 8323. So that sandbox will hardly work, you need an other one.

    May I ask, why you try to use CoAP over TCP?

    In too many cases you lose the advantages of CoAP (less ip-messages, very efficient, very reliable, and with DTLS CID (upcoming RFC 9146 ) all that with true e2e security.

Children
Related