This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF9160 BSD socket "send function" isn't blocked.

I use BSD socket to send and receive messages to a TCP server over LTE network.

When I send multiple messages by using send() (with flags = 0) function, I get an EINPROGRESS error.
It seems that send() function is not blocked.


I'm currently using the v1.1.0 release.

How can I fix this problem?

Parents Reply
  • ERROR_STATUS blocking_send(int sock, u8_t *buf, u32_t datalen, u32_t flags, uint32_t timeout)
    {
         u32_t offset = 0U;
         int ret;
         s64_t time_stamp = k_uptime_get();
         s64_t milliseconds_spent = 0;

         while ((offset < datalen)&&(milliseconds_spent <timeout))
                 {
                     ret = send(sock, buf + offset,
                                        MIN(4096, (datalen - offset)), flags);
                     if (ret < 0)
                        {
                            return -errno;
                         }

                        offset += ret;
                       milliseconds_spent += k_uptime_delta(&time_stamp);
                 }
           if(milliseconds_spent >= timeout)
                  return STATUS_TIMEOUT;
           return 0;
    }

Children
Related