<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>TCP message size</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55509/tcp-message-size</link><description>I would like to send TCP message with 50KB message size. I saw that maximum size was limited by CONFIG_HEAP_MEM_POOL_SIZE which was 16kB. 
 Is there any way to send that message ?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Dec 2019 22:37:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55509/tcp-message-size" /><item><title>RE: TCP message size</title><link>https://devzone.nordicsemi.com/thread/225044?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 22:37:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0968345-1b9b-4ea7-b42d-c19ef5d6fa80</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;Assuming you can build/hold your entire message in RAM ready to go, TCP doesn&amp;#39;t explicitly distinguish packets at the application layer, so you can send it as a bunch of smaller chunks back-to-back.&amp;nbsp; Something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int socket_write(int sock, const u8_t *data, u32_t datalen)
{
   u32_t offset = 0U;
   int ret;

   while (offset &amp;lt; datalen)
   {
      ret = send(sock, data + offset,
                 MIN(2048, (datalen - offset)), 0);
      if (ret &amp;lt; 0)
      {
         return -errno;
      }

      offset += ret;
   }

   return 0;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>