tcp sendmsg() EAGAIN handling

we have a 'long lived' tcp connection w/ regular data sends (1hz of 256 bytes for mqtt publishes) where sendmsg() sometimes returns EAGAIN. when trying again it usually works but sometimes we get the poll() read event and this indicates that the peer reset the connection.

 i interpret this as there being an erro w/ the retry, an unexpected resend should be ok but only if it matches the previous send. are there conditions that the device-side where it could resend something different?

Parents
  • Hi dpf!

    Thanks for reaching out.

    Could you give me some more details about your implementation? Specifically: your nRF Connect SDK version, your modem firmware version and whether you are using TLS or not.

    Also, can you explain how you handle the retries in the application? If you don't want to share implementation data we can make the ticket private.

    Best regards,
    Carl Richard

  • >Could you give me some more details about your implementation? Specifically: your nRF Connect SDK version, your modem firmware version and whether you are using TLS or not.

    we're using tls + v2.0.0.4 on the nrf9151-laca, and getting to sendmsg() via the zephy'rs offload.

    >Also, can you explain how you handle the retries in the application? If you don't want to share implementation data we can make the ticket private.

    basically we try twice like:

    for (tries = 0; tries < 2; tries++) {

    rv = sendmsg((s, msg, flags);

    if (rv < 0) {

    if (errno == EAGAIN && tries < 1)

    continue

    return -errno;

    }

    ... udate message iovec .. 

    }

Reply
  • >Could you give me some more details about your implementation? Specifically: your nRF Connect SDK version, your modem firmware version and whether you are using TLS or not.

    we're using tls + v2.0.0.4 on the nrf9151-laca, and getting to sendmsg() via the zephy'rs offload.

    >Also, can you explain how you handle the retries in the application? If you don't want to share implementation data we can make the ticket private.

    basically we try twice like:

    for (tries = 0; tries < 2; tries++) {

    rv = sendmsg((s, msg, flags);

    if (rv < 0) {

    if (errno == EAGAIN && tries < 1)

    continue

    return -errno;

    }

    ... udate message iovec .. 

    }

Children
Related