Skip to content

AT+CIPSEND with TCP link having non-zero so_sndtimeo leads to loss of stream synchronization after failed attempt #988

@ArtemPisarenko

Description

@ArtemPisarenko

Answers checklist.

  • I have read the documentation ESP-AT Programming Guide and the issue is not addressed there.
  • I have used the latest released firmware or have updated my ESP-AT branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

When TCP connection configured with AT+CIPTCPOPT so_sndtimeo non-default value, AT+CIPSEND expected to operate similar to non-blocking write()/send()/sendto() socket function. It may response with SEND FAIL, meaning that send buffer is full (remote peer didn't acknowledged enough data) and user should proceed with trying again this command. Am I right?

ESP doesn't report nothing in this case (except for Recv xxx bytes, which only means how many data it received from user via UART). It makes me (user) think that ESP failed to send whole chunk of data, because documentation doesn't describe such a behavior.

The problem is that it's not true. I found that ESP actually accepts (may accept, depending on how lucky you are at a given moment with sizes and buffer state) part of received data for transmission and will deliver it sooner or later. But user doesn't know size of that data chunk in order to skip it in next AT+CIPSEND attempt (to avoid sending same data twice). It breaks integrity of data stream guaranteed by TCP protocol.

I guess it's a known issue and it seems to be the reason for #908 submitted as a feature request. But I consider issue described above a serious limitation (or even bug) requiring attention.

I don't see any workaround for it (except for modifying ESP-AT firmware with custom commands).

  1. AT+CIPSENDL seems to be possible solution (because it reports +CIPSENDL:<had sent len>,<port recv len> ?), but anyway it's unacceptable because of undesirable cancelling sequence +++ (I cannot guarantee continuous UART data flow).
  2. Passthrough Mode isn't acceptable because of single-connection restriction and tricky +++ sequence.
  3. Blocking mode (so_sndtimeo = 0) isn't acceptable because it blocks whole AT command interface in unpredictable manner (e.g. other links/connections can't be processed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions