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 Reply
  • Generally, I'm not sure, if operating a CAT-M1/CAT-NB modem at 1k/s is a good idea. That depends on your SIM card contract and battery size. And I guess, it only works for CAT-M1.

    If RFC8323 is not supported, you can't use that standard for CoAP over TCP. You may try to fiddle it your own way (e.g. prepend the length ahead with 2 bytes and decode them when reading), but I'm not sure, if that is good idea.

    If it's just the payload size, there are two ways to go:

    - RFC7959 or

    - send the data in smaller packages little more frequently. If your server is fast enough, you may use NSTART-2 (means you may have two requests in flight), though RTT is in CAT-NB not that fast. (Maybe CAT-NB isn't fast enough at all.)

    Finally, even though I'm a real fan of CoAP,I'm not sure, if other protocols would fit better.

Children
No Data
Related