<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: interniche</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816293#M13553</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have never heard of the "Digibutler" until your post. I just read Marc Vandenhende's post back in 2013 and took a copy of the stack as I knew someone would be asking for it 5 years later, and you did :-).&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I do not really what is "CW 7.2 ABI change" !!??&lt;BR /&gt;&lt;BR /&gt;If you're working with CodeWarrior it is important that you do. You're using 7.1, and I assume the "old system" that works with all the sample code released to that date and all the code in the App Notes. Then in 7.2 the ABI was changed and that broke all existing code (any code that used assembly). I assume that Marc's version of the code has been changed to work with the new one.&lt;BR /&gt;&lt;BR /&gt;You should still compare Marc's sources with your original sources to find the bugs he's fixed in case he fixed your one. But you'll have to know how to recognise the changes that the 7.1 to 7.2 migration caused otherwise that may confuse you.&lt;BR /&gt;&lt;BR /&gt;Here's some notes I keep on that:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;A href="https://community.freescale.com/message/401840#401840"&gt;https://community.freescale.com/message/401840#401840&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Read my last post here:&lt;BR /&gt;&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/community.freescale.com/message/356263#356263" rel="nofollow" target="_blank"&gt;https://community.freescale.com/message/356263#356263&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This mentions that the parameter passing changed between CW7.1 and CW7.2:&lt;BR /&gt;&lt;BR /&gt;Re: Updating CW 7.1 to 7.2, using MQX 3.3,&amp;nbsp; missing librarys&lt;BR /&gt;&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/community.freescale.com/message/66959#66959" rel="nofollow" target="_blank"&gt;https://community.freescale.com/message/66959#66959&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Marc Vandenhende Jun 17, 2010 11:11 PM (in response to Mark Armbrust) &lt;BR /&gt;&lt;BR /&gt;"CW7.2 uses a different way to pass parameters to functions (REG_ABI) compared to CW7.1, which uses STD_ABI by default. These methods are not compatible with each other."&lt;BR /&gt;&lt;BR /&gt;Search (at top right of this page) for "REG_ABI".&lt;BR /&gt;&lt;BR /&gt;Other posts said that prior to 7.2 you could select either option, and all the libraries and example code on Freescale's web site defaulted to STD_ABI. With CW7.2 that option was removed, and it changed to REG_ABI. So all existing Assembly code broke, and none of the sample code (in App Notes and so on) got updated. This traps everybody, but isn't documented anywhere that I can find. It might be in the documentation provided with CW somewhere, I've never had a copy to check.&lt;BR /&gt;&lt;BR /&gt;7.12 was released in June 2nd, 2009.&lt;BR /&gt;&lt;BR /&gt;7.2 released 22 Jan 2010.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;apparently having a heap allocation problem&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;Either the Nichelite code isn't correctly freeing memory that it has malloced, is using data after being freed, is double-freeing, or your code that interfaces to it isn't allocating or freeing properly. The "standard way" to diagnose this is to completely replace the memory allocator with one that has diagnostics and that can detect and report bad operations.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;Google finds this. Try replacing your "malloc" with something like this and then run:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/scottmcpeak.com/memory-errors" rel="nofollow" target="_blank"&gt;http://scottmcpeak.com/memory-errors/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;after some days the server stopped&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;It is very hard to take a "demo project" that runs once, and then turn it into something that can run for weeks or months. That usually takes a lot of work, sometimes even a rewrite.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;calloc1.c and npalloc.c&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;Those files don't exist in the Nichelite TCP/IP sources. There's only "src/common/alloc.c" which is worryingly simple and has a comment at the top that says "99% of this code stolen/borrowed from the K&amp;amp;R C examples". So your allocator must be someone else's.&lt;/SPAN&gt;&lt;/SPAN&gt; I'm guessing (from Google searches) it is the one in the OS you're using.&lt;/P&gt;&lt;P&gt;Have you checked here for updates? I suspect Coldfire won't have been supported for years though. Correct - I've just run Nichelite's "Configurator" and Coldfire is nowhere to be seen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.hcc-embedded.com/embedded-systems-software-products/tcp-stack-networking"&gt;https://www.hcc-embedded.com/embedded-systems-software-products/tcp-stack-networking&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s. (I don't know why this editor has made the rest of my text BLUE or how to fix it, I've tried three times already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jun 2018 00:02:08 GMT</pubDate>
    <dc:creator>TomE</dc:creator>
    <dc:date>2018-06-27T00:02:08Z</dc:date>
    <item>
      <title>interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816290#M13550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can you tell me the most up-to-date version of Nichelite for coldfire processors.&lt;/P&gt;&lt;P&gt;I run a digibutler board (MFC52531) from the lektor magaize in the year 2008.&lt;/P&gt;&lt;P&gt;As I have problems with the TCP/IP stack (heap problems) I would like to know if&lt;/P&gt;&lt;P&gt;eventually a newer revision than mine (rev.3.2) exists.&lt;/P&gt;&lt;P&gt;If so please can you also provide me a link to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Werner Kurzbauer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2018 11:57:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816290#M13550</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-06-25T11:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816291#M13551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;3.2 is the latest version on Freescale's web site, dated Feb 2009.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a version, still 3.2, but with "LIST OF CHANGES MADE BY MARC VANDENHENDE, 2011-05-24".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a link to a post in this forum with a link to a copy on Dropbox, dated November 2013&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="link-titled" href="https://community.nxp.com/thread/64173?commentID=101060#comment" title="https://community.nxp.com/message/101060?commentID=101060#comment-101060"&gt;https://community.nxp.com/message/101060?commentID=101060#comment-101060&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not surprisingly, it isn't on Dropbox any more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I've attached it to this post. I don't know if it fixes your problem. From a quick look at the "Changes" document I couldn't see anything that obviously matched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may have to debug it, but at least you'll be starting from something with less bugs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Watch out for the big and horrible "CW 7.2 ABI change" which might affect this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you search this forum for "nichelite" you'll find about 56 posts. Have you looked through them, and did you find anything there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2018 14:07:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816291#M13551</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-06-26T14:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816292#M13552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for your quick response!!! Actually I did not expect that&amp;nbsp;anyone is still responding on a "digibutler" topic...&lt;/P&gt;&lt;P&gt;I currently try to adapt the rev.3.2 to&amp;nbsp;my digibutler board (as specifically the cpu definitions appear to have changed from&lt;/P&gt;&lt;P&gt;the previous Nichelite version).&lt;/P&gt;&lt;P&gt;As you are also using a Digibutler may I ask if you also noticed the problem that after some days the server stopped apparently having a heap allocation problem (calloc1.c and npalloc.c report problems via printf (RS232) and the ftp stack stop to work).&lt;/P&gt;&lt;P&gt;I tried to find the problem but only with little success as it might really be located deep in the guts of the system.&lt;/P&gt;&lt;P&gt;Maybe you found&amp;nbsp; a solution...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My hope was this new revision but the migration of my own code and the adaption to my digibutler board seem to require much more effort than hoped.&lt;/P&gt;&lt;P&gt;Did you already adapt the cpu definitions of rev.3.2. to the digibutler board?&lt;/P&gt;&lt;P&gt;I use codewarrior 7.1 so I hope I do not have any problem from the compiler side (I do not really what is "CW 7.2 ABI change" !!??).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are still interested in fiddling around with the digibutler board&lt;/P&gt;&lt;P&gt;&amp;nbsp;I really appreciate an exchange of knowledge and experience!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot and regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2018 15:21:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816292#M13552</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-06-26T15:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816293#M13553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have never heard of the "Digibutler" until your post. I just read Marc Vandenhende's post back in 2013 and took a copy of the stack as I knew someone would be asking for it 5 years later, and you did :-).&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I do not really what is "CW 7.2 ABI change" !!??&lt;BR /&gt;&lt;BR /&gt;If you're working with CodeWarrior it is important that you do. You're using 7.1, and I assume the "old system" that works with all the sample code released to that date and all the code in the App Notes. Then in 7.2 the ABI was changed and that broke all existing code (any code that used assembly). I assume that Marc's version of the code has been changed to work with the new one.&lt;BR /&gt;&lt;BR /&gt;You should still compare Marc's sources with your original sources to find the bugs he's fixed in case he fixed your one. But you'll have to know how to recognise the changes that the 7.1 to 7.2 migration caused otherwise that may confuse you.&lt;BR /&gt;&lt;BR /&gt;Here's some notes I keep on that:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;A href="https://community.freescale.com/message/401840#401840"&gt;https://community.freescale.com/message/401840#401840&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Read my last post here:&lt;BR /&gt;&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/community.freescale.com/message/356263#356263" rel="nofollow" target="_blank"&gt;https://community.freescale.com/message/356263#356263&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This mentions that the parameter passing changed between CW7.1 and CW7.2:&lt;BR /&gt;&lt;BR /&gt;Re: Updating CW 7.1 to 7.2, using MQX 3.3,&amp;nbsp; missing librarys&lt;BR /&gt;&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/community.freescale.com/message/66959#66959" rel="nofollow" target="_blank"&gt;https://community.freescale.com/message/66959#66959&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Marc Vandenhende Jun 17, 2010 11:11 PM (in response to Mark Armbrust) &lt;BR /&gt;&lt;BR /&gt;"CW7.2 uses a different way to pass parameters to functions (REG_ABI) compared to CW7.1, which uses STD_ABI by default. These methods are not compatible with each other."&lt;BR /&gt;&lt;BR /&gt;Search (at top right of this page) for "REG_ABI".&lt;BR /&gt;&lt;BR /&gt;Other posts said that prior to 7.2 you could select either option, and all the libraries and example code on Freescale's web site defaulted to STD_ABI. With CW7.2 that option was removed, and it changed to REG_ABI. So all existing Assembly code broke, and none of the sample code (in App Notes and so on) got updated. This traps everybody, but isn't documented anywhere that I can find. It might be in the documentation provided with CW somewhere, I've never had a copy to check.&lt;BR /&gt;&lt;BR /&gt;7.12 was released in June 2nd, 2009.&lt;BR /&gt;&lt;BR /&gt;7.2 released 22 Jan 2010.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;apparently having a heap allocation problem&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;Either the Nichelite code isn't correctly freeing memory that it has malloced, is using data after being freed, is double-freeing, or your code that interfaces to it isn't allocating or freeing properly. The "standard way" to diagnose this is to completely replace the memory allocator with one that has diagnostics and that can detect and report bad operations.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;Google finds this. Try replacing your "malloc" with something like this and then run:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/scottmcpeak.com/memory-errors" rel="nofollow" target="_blank"&gt;http://scottmcpeak.com/memory-errors/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;after some days the server stopped&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;It is very hard to take a "demo project" that runs once, and then turn it into something that can run for weeks or months. That usually takes a lot of work, sometimes even a rewrite.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;calloc1.c and npalloc.c&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="jive-comment-meta font-color-meta-light"&gt;&lt;SPAN class="j-username-wrap"&gt;Those files don't exist in the Nichelite TCP/IP sources. There's only "src/common/alloc.c" which is worryingly simple and has a comment at the top that says "99% of this code stolen/borrowed from the K&amp;amp;R C examples". So your allocator must be someone else's.&lt;/SPAN&gt;&lt;/SPAN&gt; I'm guessing (from Google searches) it is the one in the OS you're using.&lt;/P&gt;&lt;P&gt;Have you checked here for updates? I suspect Coldfire won't have been supported for years though. Correct - I've just run Nichelite's "Configurator" and Coldfire is nowhere to be seen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.hcc-embedded.com/embedded-systems-software-products/tcp-stack-networking"&gt;https://www.hcc-embedded.com/embedded-systems-software-products/tcp-stack-networking&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s. (I don't know why this editor has made the rest of my text BLUE or how to fix it, I've tried three times already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 00:02:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816293#M13553</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-06-27T00:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816294#M13554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know about the Digibutler but never used it.&lt;/P&gt;&lt;P&gt;It may well be that you can run the NicheLite stack on the Digibutler without modification. I had it running on both MCF52233 and MCF52235 MCUs without change. You do have to compile the stack on codewarrior 7.2 however, preferrably with all updates installed. Some of the modifications I did were to make it compatible with this version and have to do with the REG_ABI thingy. When REG_ABI is used, parameters are passed to subroutines via CPU registers instead of the stack. This is taken care of automatically by the compiler, but if the program also contains assembly language routines that assume parameters are being passed by the stack, these routines will no longer function properly. Interniche does contain some assembly language routines, which I modified to take parameters via the CPU registers instead of the stack.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 10:59:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816294#M13554</guid>
      <dc:creator>vier_kuifjes</dc:creator>
      <dc:date>2018-06-27T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816295#M13555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the responses. The digibutler board uses the MFC52231 and was originally supplied with CW 6.3,&amp;nbsp; the freescale_HTTP_Web_Server by Eric Gregori and cpu definitions tailored to the board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used CW7.1 to compile my code and I hoped that this CW version can also be used with the rev.3.2 of nichelite as long as I use the MFC52231 (I do not know if rev.3.2 still supports MFC52231)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to install a CW7.2 version though...but it still denies to install on my 64-bit machine&amp;nbsp;&amp;nbsp; :smileysad:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@tom: I was a little sloppy concerning the functions reporting the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; these are calloc1() in MEMIO.C and npalloc() in iutil.c&lt;/P&gt;&lt;P&gt;I will follow your suggestion to replace the memory allocator....&lt;/P&gt;&lt;P&gt;However as I used the freescale_HTTP_Web_Server by Eric Gregori (still available at NXP)&amp;nbsp; I hoped that such severe bugs do not occur.&amp;nbsp; Also in the forums the issue is only rarely discussed and in fact no solution provided,,,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I went through the code changes in rev.3.2 I noticed that FSL (I don't know for who the shortcut stands for) apparently modified and revised the freescale ("Gregori") version and not a "generic" interniche version. So maybe the bug is still not removed...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 16:52:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816295#M13555</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-06-27T16:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816296#M13556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; these are calloc1() in MEMIO.C and npalloc() in iutil.c&lt;/P&gt;&lt;P&gt;ColdFire_Lite_M52259EVB/src/projects/NicheLite/Source/cf_specific/iutil.c&lt;/P&gt;&lt;P&gt;ColdFire_Lite_M52259EVB/src/projects/NicheLite/Source/misclib/MEMIO.C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enable "NPDEBUG" in MEMIO.C and see if it finds anything if you haven't done that already. Also "MEMIO_DEBUG".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also note that "npalloc():" is documented as "Wrappers for heap calls, with memory clearing and counters", so write some code to print those counters. The only current way is to enable "HEAP_STATS" which prints on every alloc and free. That may overload your system, or it may be the way to debug this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most likely problem is a memory leak. Something is allocating memory and not freeing it. On a system with a lot of free memory you either have to actually TEST code that uses malloc() and free() to make sure it isn't leaking, or you have to wait a long time until all the memory is used up. Or you can change the heap allocation function (mheap_init()) to return an artificially small heap to force these problems to happen sooner. It is likely nobody has done that with some or all parts of this code, so that's now your job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also enable "HEAP_STATS" and periodically (once a minute should be enough) call "mh_stats()". I would suggest you improve the debugging by adding code to print the "npalloc()" wrapper counters at the same time. That should tell you if you're suffering from a "memory leak" where some code is allocating a block and then never freeing it. You should also be able to see if a "leak" corresponds to a particular operation on the stack or the web server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Better still, why not generate a Web Page that gives all of the current memory statistics? Then you can monitor it in real time!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For these problems that don't happen all that often, it is likely the "leak" is in an error case, like a bad or aborted web page access, or a TCP socket that is aborted rather than properly closed. Windows has a habit of not closing TCP connections properly, which can cause embedded systems to run out of memory or sockets with all the connections in "Timeout" state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; FSL (I don't know for who the shortcut stands for) apparently modified and revised the &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;f&lt;/STRONG&gt;&lt;STRONG&gt;reescale&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/FSL"&gt;https://en.wikipedia.org/wiki/FSL&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's Freescale's New York Stock Exchange Ticker symbol too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 23:48:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816296#M13556</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-06-27T23:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816297#M13557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I enabled "HEAP_STATS" to get the heap information but strange enough, apart from the enabled functionality,&lt;/P&gt;&lt;P&gt;every time when a web-page is loaded from my freescale server the following message appears 3 times:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access error -- PC = 0x00006F66&lt;/P&gt;&lt;P&gt;Error on operand write&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appartently the mcf5xxx_exception_handler (void *framep) in mcf5xxx.c is called...&lt;/P&gt;&lt;P&gt;The reported address is in the module TCPIN.C&lt;/P&gt;&lt;P&gt;in the function "tcp_xmit_timer(struct tcpcb * tp)"&amp;nbsp; at address 0x00006F66:&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;; 1384:&amp;nbsp;&amp;nbsp;&amp;nbsp; TCPT_RANGESET(tp-&amp;gt;t_rxtcur, &amp;nbsp;&lt;BR /&gt;; 1385:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (short)(((tp-&amp;gt;t_srtt &amp;gt;&amp;gt; 2) + tp-&amp;gt;t_rttvar) &amp;gt;&amp;gt; 1), &lt;BR /&gt;; 1386:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TCPTV_MIN, TCPTV_REXMTMAX); &lt;BR /&gt;;&lt;BR /&gt;0x00006F4C&amp;nbsp; 0x303C0080&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.w&amp;nbsp;&amp;nbsp; #128,d0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; '..'&lt;BR /&gt;0x00006F50&amp;nbsp; 0x3F40000A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.w&amp;nbsp;&amp;nbsp; d0,10(a7)&lt;BR /&gt;0x00006F54&amp;nbsp; 0x7002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; moveq&amp;nbsp;&amp;nbsp;&amp;nbsp; #2,d0&lt;BR /&gt;0x00006F56&amp;nbsp; 0x3F400006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.w&amp;nbsp;&amp;nbsp; d0,6(a7)&lt;BR /&gt;0x00006F5A&amp;nbsp; 0x202E0074&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; 116(a6),d0&lt;BR /&gt;0x00006F5E&amp;nbsp; 0xE480&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asr.l&amp;nbsp;&amp;nbsp;&amp;nbsp; #2,d0&lt;BR /&gt;0x00006F60&amp;nbsp; 0xD0AE0078&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add.l&amp;nbsp;&amp;nbsp;&amp;nbsp; 120(a6),d0&lt;BR /&gt;0x00006F64&amp;nbsp; 0xE280&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asr.l&amp;nbsp;&amp;nbsp;&amp;nbsp; #1,d0&lt;BR /&gt;0x00006F66&amp;nbsp; 0x3F400002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.w&amp;nbsp;&amp;nbsp; d0,2(a7)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;0x00006F6A&amp;nbsp; 0x4EB900005ECC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jsr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00005ecc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 0x00005ecc&lt;BR /&gt;0x00006F70&amp;nbsp; 0x48C0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext.l&amp;nbsp;&amp;nbsp;&amp;nbsp; d0&lt;BR /&gt;0x00006F72&amp;nbsp; 0x2D400020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; d0,32(a6)&lt;BR /&gt;;&lt;BR /&gt;; 1387: } &lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not know why this exception is only shown when "HEAP_STATS" is enabled and I do not know wheter this&lt;/P&gt;&lt;P&gt;is a compiler problem or a code problem. However it might well be one step towards a solution of the problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I ask you if you have any idea...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2018 15:18:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816297#M13557</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-06-28T15:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816298#M13558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is all standard debugging. Do you have a debug pod? Can you single-step? Can you put a breakpoint on that instruction and dump the stack and the registers to see what's going on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You haven't said if you have turned NPDEBUG and/or MEMIO_DEBUG on. Have you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this only happens with "HEAP_STATS".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have the Nichelite code easily viewable, but you should do what I would. Which is to look at the sources of the multiple layers of the memory allocator, and then see what CHANGES in that code when you turn the debugs on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I remember that one of the debugs added "poison" or a "pattern" to freed blocks. That is to see if something is writing to a block after it has been freed. It is likely that your code is READING from a block after it has been freed, and it getting upset because it is reading the "poison" value. This doesn't happen without the debug flags as it is probably reading "Stale, but legitimate" data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is in "tcp_xmit_timer()". It is possible that the TCP connection creates a "Transmit Timer" and puts it on a "Timer Queue" to be activated. When the socket closes it is important/essential that that close cleanly removes all references to freed data, including anything it puts on a timer queue. Maybe it doesn't. You'll have to read the code and draw up a lot of flowcharts, or single-step (a lot) or add debug printing to find this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error you're getting is strange. The code is setting up to call a function, and is pushing four parameters onto the stack, as 128 -&amp;gt; 10(A7), 2 -&amp;gt; 6(A7) and the sum in the middle to 2(A7). There must be a fourth one you didn't include in the code you quoted. Anyway, if the first two worked, then I can't see how the third one would fail. They're all storing to addresses that are very close (on the stack). It isn't as if one can be a "wild pointer" different to the other ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if you can make the Exception Handler tell you something more useful than what it is doing. Read through the "Exception Handling" chapter of the CPU manual. It would be REALLY useful if the handler could tell you WHICH exception happened. Just printing the "Format Vector Word" would help. If it doesn't to this you should be able to add code to make it do so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And do all the other things I suggested, like printing statistics and counters so you can see leaks as they happen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Edit)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Anyway, if the first two worked, then I can't see how the third one would fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To work that out you have to read the "Coldfire Core" Chapter in the Reference Manual, specifically the "Access Error Exceptions" section, as that would seem to be what you're getting. It said "Access Error" and there are 10 different codings in the Exception Word, four of which are valid, and one matches "Error on Operand Write". For the CFV2 though, the section says:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;The V2 ColdFire processor uses an imprecise reporting mechanism for access errors on operand&lt;BR /&gt;writes. Because the actual write cycle may be decoupled from the processor’s issuing of the&lt;BR /&gt;operation, the signaling of an access error appears to be decoupled from the instruction that&lt;BR /&gt;generated the write. Accordingly, the PC contained in the exception stack frame merely represents&lt;BR /&gt;the location in the program when the access error was signaled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the one thing I can saw with some confidence is that the Write you have marked at "6F66" wasn't the one that failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still, there were TWO previous writes to the stack (memory referenced by A7) and the CFv2 doesn't have a deep enough write pipeline for it to have blown up three or more writes earlier, so there must still be something wrong with the stack address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another problem is that it is very hard to get an "Access Error" on the Coldfire. All of memory is mapped, there's no Memory Management unit. You're (probably) not running with Supervisor and User mode, so there's no "memory you can't get to". It doesn't usually flag accesses to address spaces with no memory present either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to drop into the debugger and see what A7 is. You also want to get it to give you a register dump at the time of the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is possible your system is configured with a small stack, and the extra printing that "HEAP_STATS" is doing is walking off the end of the stack, causing corruptions. This is another fault condition that CPUs with memory management catch for you, but simpler ones like the CFV2 let you get wrong without giving you any help at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2018 09:02:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816298#M13558</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-06-29T09:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816299#M13559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your useful advices.&lt;/P&gt;&lt;P&gt;After some investigations if&amp;nbsp;think I could localize the problem.&lt;/P&gt;&lt;P&gt;First of all the statics variable in memio.c (mh_totfree) is wrongly set in the mem_free()&amp;nbsp; function and has a negative overflow after some time&amp;nbsp;(the length of the header structure is not properly registered in the statictics in case of blocks are freed or allocated which are not at the end of the heap).&lt;/P&gt;&lt;P&gt;The heapstat monitor (mh_stats()) therefore reports false values.&lt;/P&gt;&lt;P&gt;However the heap as such seems to work properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is the freescale HTTP server:&lt;/P&gt;&lt;P&gt;When my server is connected to the net it is sometimes "visited" by some unwanted guests (probably IP-scanners) and if this is the case the memory after the "attack" is not properly freed.&lt;/P&gt;&lt;P&gt;It seems that my bowser sents is able to send a&amp;nbsp; response without getting an error fom m_send (M_SOCK...) but then the session is not properly terminated and I assume the socket is not properly closed or something like that?&lt;/P&gt;&lt;P&gt;So the available hep gets smaller and smaller and after some time the system collapses....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have to dive into the freescale server code to really find the problem (I again hope that the TCP/IP stack operates properly). As the attacks are not predictable this can take some time.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I ask if this problem is known to you?&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2018 08:06:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816299#M13559</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-07-06T08:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816300#M13560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; The heapstat monitor (mh_stats()) therefore reports false values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you fixed it so you can trust it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; My problem is the freescale HTTP server:&lt;/P&gt;&lt;P&gt;&amp;gt; When my server is connected to the net it is sometimes "visited" by some&lt;/P&gt;&lt;P&gt;&amp;gt; unwanted guests (probably IP-scanners) and if this is the case the memory&lt;/P&gt;&lt;P&gt;&amp;gt; after the "attack" is not properly freed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure that's what is happening? I suspect there is no bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what should you do if the server does have a bug that leads to a memory leak?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guess what Apache does? The last time I looked at the code (10 years ago, so it might have changes), an Apache server spawns multiple threads forming a "pool". Each one is allocated to incoming client requests. After a client has responded to about 100 requests, IT IS KILLED AND RESTARTED! That is because it is assumed that it will leak, and rather than actually fix the bugs it is easier to simply kill it and clean up any mess. Of course the servers are running on top of an OS that keeps a separate memory pool per process and keeps a list of all file handles and sockets. So everything is cleanly released when the "kill" happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a lot harder to do on embedded systems!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should be able to tell from the memory statistics how big each "leak" is. Then compare that "leak size" with all the "request sized" looking for a match. You could even log every allocation and free, logging the caller function address. That would let you know what code isn't freeing when it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A standard "problem" (actually design characteristic) of TCP/IP is that a connection is expected to stay open FOR EVER unless deliberately closed. And it will stay open without traffic and without sending any data. This is not a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a "Feature" of standard (large, on Linux and Windows) TCP/IP systems called "Keepalive". There's a conflict between selfish programmers who would like "keepalives" every few seconds and the "Old Net Gods" who rightly said "that doesn't SCALE" and so required the MINIMUM time for the keepalives to be 2 HOURS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://en.wikipedia.org/wiki/Keepalive#TCP_keepalive" title="https://en.wikipedia.org/wiki/Keepalive#TCP_keepalive"&gt;Keepalive - Wikipedia&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I suspect your "attacks" are performing HTTP Opens which are first causing TCP Opens, and then either aren't sending any data, or are sending a bit and then go off to attack something else without closing the connection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing that will cause the connection to drop is either a deliberate timeout in the server, or something that makes the server want to send some data on the connection. The retries on the send will eventually close the connection, but NOTHING ELSE WILL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The proper way to monitor this is to add a command to the system (maybe even a web page) that lists or counts all the open connections. Linux machines have "netstat -s". Windows has "netstat". You want to write an equivalent for your system. Especially if you can add a column listing how long the socket has been open for. Then you can see if the number of open sockets is increasing without limit (and taking up memory without limit).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe modern servers have timeouts to handle this problem. Maybe the Freescale one is so old (and meant as a demo rather than a bulletproof on-the-internet server) that it doesn't have any sort of timeout, or it does, but it isn't turned on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this the one you're running, or is it another one? Where's the source?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Freescale\NicheliteColdfireLite\7.2 REG_ABI 20110524.zip\7.2 REG_ABI 20110524\CF_Lite_v3.2_MVDH_20110524_CW7.2\src\projects\example\freescale_HTTP_Web_Server"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could rely on KEEPALIVEs to close sockets. But you might run out of them or memory way before two hours is up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's how to configure it in the 2009 version, with a recommendation on dropping the timeout from 2 hours to as low as a minute (for embedded systems). It even includes source code and documents a bug in that version that means it won't work properly with Windows, but it also gives a patch to fix that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.nxp.com/docs/en/application-note/AN10775.pdf" title="https://www.nxp.com/docs/en/application-note/AN10775.pdf"&gt;https://www.nxp.com/docs/en/application-note/AN10775.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a post from 2010 saying it doesn't time out. But the original poster may not have turned it on. There's a post in there from Marc on his fixes to Nichelite too. I've searched the Freescale Nichelite documentation and didn't get a match on "keepalive" (or even "keep" or "timeout").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what happens if you search the code for keywords:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;$ find . -type f | xargs grep KEEPALIVE&lt;BR /&gt;./NicheLite/Source/h/msock.h:#define&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SO_KEEPALIVE&amp;nbsp;&amp;nbsp; 0x0008&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* keep connections alive */&lt;BR /&gt;./NicheLite/Source/mtcp/tcp_timr.c:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((((M_SOCK)(tp-&amp;gt;t_inpcb))-&amp;gt;so_options &amp;amp; SO_KEEPALIVE) &amp;amp;&amp;amp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;$ find . -type f | xargs grep TCPT_KEEP&lt;BR /&gt;./NicheLite/Source/h/mtcp.h: * The TCPT_KEEP timer is used to keep connections alive.&amp;nbsp; If an&lt;BR /&gt;./NicheLite/Source/h/mtcp.h: * an ack segment in response from the peer.&amp;nbsp; If, despite the TCPT_KEEP&lt;BR /&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TCPT_KEEP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* keep alive */&lt;BR /&gt;./NicheLite/Source/mtcp/TCPAPI.C:&amp;nbsp;&amp;nbsp; tp-&amp;gt;t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;&amp;nbsp;&amp;nbsp; /* initial connect keep alive */&lt;BR /&gt;./NicheLite/Source/mtcp/TCPIN.C:&amp;nbsp;&amp;nbsp; tp-&amp;gt;t_timer[TCPT_KEEP] = tcp_keepidle;&lt;BR /&gt;./NicheLite/Source/mtcp/TCPIN.C:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp-&amp;gt;t_timer[TCPT_KEEP] = TCPTV_PERSMAX;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL was TCPTV_KEEP_INIT;&lt;BR /&gt;./NicheLite/Source/mtcp/tcp_timr.c:&amp;nbsp;&amp;nbsp; case TCPT_KEEP:&amp;nbsp;&amp;nbsp; //FSL case 2&lt;BR /&gt;./NicheLite/Source/mtcp/tcp_timr.c:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp-&amp;gt;t_timer[TCPT_KEEP] = (short)tcp_keepintvl;&lt;BR /&gt;./NicheLite/Source/mtcp/tcp_timr.c:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp-&amp;gt;t_timer[TCPT_KEEP] = (short)tcp_keepidle;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp; TCPTV_KEEP_INIT&amp;nbsp;&amp;nbsp; (75*PR_SLOWHZ)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* initial connect keep alive */&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PR_SLOWHZ&amp;nbsp;&amp;nbsp; 2&amp;nbsp; /* TCP ticks per second */&lt;BR /&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp; TCPTV_SRTTDFLT&amp;nbsp;&amp;nbsp;&amp;nbsp; (3*PR_SLOWHZ)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* assumed RTT if no info */&lt;BR /&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp; TCPTV_PERSMIN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (5*PR_SLOWHZ)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* retransmit persistance */&lt;BR /&gt;./NicheLite/Source/h/mtcp.h://#define&amp;nbsp; TCPTV_PERSMAX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (60*PR_SLOWHZ)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* maximum persist interval */&lt;BR /&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp; TCPTV_PERSMAX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (10*PR_SLOWHZ)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* maximum persist interval */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL lowered&lt;BR /&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp; TCPTV_KEEP_INIT&amp;nbsp;&amp;nbsp; (75*PR_SLOWHZ)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* initial connect keep alive */&lt;BR /&gt;./NicheLite/Source/h/mtcp.h:#define&amp;nbsp; TCPTV_KEEP_IDLE&amp;nbsp;&amp;nbsp; (120*60*PR_SLOWHZ)&amp;nbsp;&amp;nbsp; /* dflt time before probing */&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;There's no demo code that sets that socket option anywhere. Maybe you should add it to the HTTP server where it opens its sockets. And you might like to change the "two hours" definition above for TCPTV_KEEP_IDLE to something quicker. Except there's a "FSL" comment in there that may have changed how this worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The simplest way around all of these problems is to just reset the box periodically, or to have a monitor check memory and sockets and reset if it is about to run out. If it already crashes when it runs out of memory then you've already done that :-).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's assuming it is a TCP problem. It may still be a bug as you've said. In which case it should be easy to find and fix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2018 04:07:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816300#M13560</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-07-07T04:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816301#M13561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I localized the problem:&lt;/P&gt;&lt;P&gt;In TCPIN.C in the function tcp_rcv (PACKET pkt)&lt;/P&gt;&lt;P&gt;the following code makes the problem :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (tiflags &amp;amp; TH_RST)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (tp-&amp;gt;t_state) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_SYN_RECEIVED:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; so-&amp;gt;error = ECONNREFUSED;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto close;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_ESTABLISHED:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TCP_MIB_INC(tcpEstabResets);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* keep MIB stats */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_FIN_WAIT_1:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_FIN_WAIT_2:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_CLOSE_WAIT:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; so-&amp;gt;error = ECONNRESET;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; close:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp-&amp;gt;t_state = TCPS_CLOSED;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TCP_STAT_INC(tcps_drops);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_tcpclose(tp);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (so-&amp;gt;callback)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; so-&amp;gt;callback(M_CLOSED, so, NULL);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO_DROP;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;----------------------------------------------&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_CLOSING:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_LAST_ACK:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case TCPS_TIME_WAIT:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_tcpclose(tp);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO_DROP;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on the marked location the code jumps to the label "drop":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; tcp_pktfree(pkt);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* destroy temporarily created socket */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if (dropsocket)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_delsocket(so);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; return SUCCESS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that if dropsocket is 0 (and this apparently the case) the socket is not properly deleted. I assume that this is in fact the goal in the above location !?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the code in that&amp;nbsp; I do not jump to the label included&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tcp_pktfree(pkt);&lt;/P&gt;&lt;P&gt;m_delsocket(so);&lt;/P&gt;&lt;P&gt;return (0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;directly in the above case option.&lt;/P&gt;&lt;P&gt;I do have to admitt that I do not fully understand what happens but I&amp;nbsp; hope this fixes the problem...&lt;/P&gt;&lt;P&gt;Maybe you know more...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2018 10:39:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816301#M13561</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-07-07T10:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816302#M13562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't look right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking to see what "dropsocket" is really for, at line 441:&lt;/P&gt;&lt;PRE style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Mark socket as temporary until we're
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * committed to keeping it.&amp;nbsp; The code at
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * ``drop'' and ``dropwithreset'' check the
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * flag dropsocket to see if the temporary
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * socket created here should be discarded.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * We mark the socket as discardable until
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * we're committed to it below in TCPS_LISTEN.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/PRE&gt;&lt;P&gt;What that tells me is that the code is structured to get a socket, and then hand it off to the next level of code, making it IT'S RESPONSIBILITY to dispose of it at the right time. By calling "m_delsocket()".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So search for everywhere else in the code where "m_delsocket()" is called, and you'll find it being called in m_close().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you dispose of it in "tcp_rcv()" when something else is still using it, you'll risk bad memory corruption when the socket is freed the second time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So something, possible the HTTP Server isn't following the rules, and may not be calling through to m_close() properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is likely that some simple code was written for Linux or Windows, and rather than closing the socket properly under all circumstances (normal close and error cases) it just bails or aborts or something. On Linux and Windows, when a program does that, the OS cleans up after the program so that a messy, but OK way to write code. There is no OS to do that here - the program has to follow the rules and shut down everything cleanly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking again at the code you quoted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding-left: 30px;"&gt;if (tiflags &amp;amp; TH_RST)&lt;/PRE&gt;&lt;P&gt;That only happens when a socket is (or was) open and receives a RESET segment from the remote.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What is MEANT to happen is this triggers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (so-&amp;gt;callback)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; so-&amp;gt;callback(M_CLOSED, so, NULL);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO_DROP;&lt;/PRE&gt;&lt;P&gt;The "callback" is meant to be there, and IT is meant to cleanly close the socket. If it is being called and it doesn't close the socket, then that's the bug. If there is no callback registered, and so there's nothing there to perform that operation, then the bug is that it got to here with no callback and nothing closing the socket.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think a better change would be to change the above to catch this possible case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (so-&amp;gt;callback)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; so-&amp;gt;callback(M_CLOSED, so, NULL);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dropsocket = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO_DROP;&lt;/PRE&gt;&lt;P&gt;Also add some sort of debug printing code to the above added line (remembering to add braces), to see if that is actually happening. Then you can see if that fixes the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2018 06:10:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816302#M13562</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-07-09T06:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816303#M13563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I modified the code according to your suggestion (setting dropsocket = 1 in case&amp;nbsp;of no callback).&lt;/P&gt;&lt;P&gt;However this again lead to a number of &amp;nbsp;undeleted sockets and reducing the heap after each attack.&lt;/P&gt;&lt;P&gt;To my understanding the callback function freescale_http_cmdcb(int code, M_SOCK so, void * data) only closes and deletes the socket (by executing freescale_http_remove( M_SOCK so )) if it was a "VALID_EMG_SESSION".&lt;/P&gt;&lt;P&gt;If not&amp;nbsp; - the callback function is called without closing the socket&amp;nbsp;and the else-branch setting the variable "dropsocket" to&amp;nbsp;1 is not executed.&lt;/P&gt;&lt;P&gt;Therefore the socket is not deleted after jumping to the label "drop".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I enabled the debug variable netstat and after calling the command "sockets"&lt;/P&gt;&lt;P&gt;a huge number of sockets having no TCPCB were listed...(one can see that the&lt;/P&gt;&lt;P&gt;ip addresses coming from various attackers...):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Nichlite rev.3.2 issuing the command socket also deletes all sockets having no TCPCB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; for (so = (M_SOCK)msoq.q_head; so; so = so-&amp;gt;next)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ns_printf(pio,"%lx,&amp;nbsp; %u.%u.%u.%u, %u-&amp;gt;%u, ", /*(long)*/so, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUSH_IPADDR(so-&amp;gt;fhost), (so-&amp;gt;lport), (so-&amp;gt;fport));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ns_printf(pio,"0x%x, %u, %u", (unsigned)so-&amp;gt;so_options,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (unsigned)so-&amp;gt;rcvdq.sb_cc, (unsigned)so-&amp;gt;sendq.sb_cc);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp = so-&amp;gt;tp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tp)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ns_printf(pio, ", %ld, %ld, %s\n", tp-&amp;gt;snd_una, tp-&amp;gt;snd_nxt, tcpstates[tp-&amp;gt;t_state]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ns_printf(pio, " (no TCPCB)\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; m_delsocket(so);&amp;nbsp;&amp;nbsp;//FSL No TCPCB then delete socket (so)...might want to implement this capability elsewhere&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&amp;lt;&amp;lt;--&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thus after issuing the command my heap again nearly growed to its original size (except one socket&amp;nbsp;in FIN_WAIT_2 state which seems to linger in the socket list forever without being deleted..).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is when can I (automatically) delete all those sockets having no TCPCB without causing any further troubles?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2018 09:57:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816303#M13563</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-07-10T09:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816304#M13564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; To my understanding the callback function freescale_http_cmdcb ...&lt;/P&gt;&lt;P&gt;Maybe it is wrong or wrongheaded. The TCP "closing" code (in its various flavours) has to signal back to the user that a "request to close" has happened or a close has completed. The socket interface to the "user code" (the http server) doesn't support asynchronous notification of this sort of thing, so the only "signal" is a return code to the "read()", "recv()", "send()" and other calls. The user code should then "close()" the socket.&lt;/P&gt;&lt;P&gt;The underlying way it has to work is documented here, and best shown in the diagram on page 23:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://tools.ietf.org/html/rfc793" rel="nofollow noopener noreferrer" target="_blank"&gt;https://tools.ietf.org/html/rfc793&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An easier to read version is here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol#/media/File:Tcp_state_diagram_fixed_new.svg" rel="nofollow noopener noreferrer" target="_blank"&gt;https://en.wikipedia.org/wiki/Transmission_Control_Protocol#/media/File:Tcp_state_diagram_fixed_new.svg&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the second of the above, if the other end terminates an "ESTABLISHED" connection by sending "FIN", the stack sends "ACK" and goes to "CLOSE WAIT". Somehow it signals this state to the user that then performs the "CLOSE", the stack send a "FIN" and waits for an "ACK". Note it will stay there "forever" according to the diagram and the original protocol. In practice there has to be a time out here. If the User Code sends a "CLOSE" to "ESTABLISHED", then you have to end up in "TIME_WAIT". If you ask Google "how long is TCP TIME WAIT timeout" it'll tell you "4 minutes".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're in "FIN WAIT 2" then it means your user code issued "CLOSE", the stack send FIN, received the ACK and from "FIN WAIT 2" is waiting for the other end to play nice and send its "FIN" to which this stack will send "ACK". The other end isn't playing nice. Its stack has signaled the event at its end, and is waiting for that user code to call "CLOSE", and it isn't. If it is an "attacker" there's no reason for it to play nice. There's another path not shown on that diagram. If your code has sent data or the FIN it will retry it until it gets the ACK or until there's a very long timeout, at which point it'll abort somehow. But it can legitimately stay in "FIN WAIT 2" "for ever". People have added timers to get out of this jail. You'll have to check the Nichelite code to see if it has one of these. For reference, here's something Microsoft did:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/windows-hardware/drivers/network/fin-wait-2-timer" rel="nofollow noopener noreferrer" target="_blank"&gt;https://docs.microsoft.com/en-us/windows-hardware/drivers/network/fin-wait-2-timer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the hooks under Linux:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://serverfault.com/questions/7689/how-do-i-get-rid-of-sockets-in-fin-wait1-state" rel="nofollow noopener noreferrer" target="_blank"&gt;https://serverfault.com/questions/7689/how-do-i-get-rid-of-sockets-in-fin-wait1-state&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; The problem is when can I (automatically) delete all those sockets having no TCPCB without causing any further troubles?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is "how did they get like that?". There's something wrong with the stack or user code that is doing that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;gt; m_delsocket(so);&amp;nbsp;&amp;nbsp;//FSL No TCPCB then delete socket (so)...might want to implement this capability elsewhere&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When Freescale worked on this code they added at least 704 "FSL" comments as they went about changing the code. So you "might want to implement this capability elsewhere".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This comment might be useful:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding-left: 30px;"&gt;//FSL **have newly created so socket have pointer to newly created tcpcb
//FSL Note: there is always a socket/tcpcb pair and they have pointer to each other&lt;/PRE&gt;&lt;P&gt;That may mean if there's a socket with "so-&amp;gt;tp" being NULL then it is safe to delete it. As long as it isn't on a timer queue or something. Make sure the "socket delete" function stops all timers and removes it from all queues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 05:21:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816304#M13564</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-07-11T05:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816305#M13565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;After studying your hints and advices I finally&amp;nbsp; decided to implement a socket purge function which is called by the taskmanager every xx seconds (I chose 20min).&lt;/P&gt;&lt;P&gt;The function removes all sockets without TCPCB and all sockets in FIN_WAIT_2&amp;nbsp; (whereby at the first call the&lt;/P&gt;&lt;P&gt;waiting sockets are only marked (i.e. put in a list) and finally deleted after CNT_DOWN times calling the purge function.&lt;/P&gt;&lt;P&gt;Up until now I was able to keep the heap....&amp;nbsp; :smileywink:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* FUNCTION: purge sockets()&lt;BR /&gt;&amp;nbsp;* &lt;BR /&gt;&amp;nbsp;* PARAM1: void * pio&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;* RETURNS: nothing&lt;BR /&gt;&amp;nbsp;*/&lt;BR /&gt;#define MAX_STUCK_SOCKETS 5&lt;BR /&gt;#define CNT_DOWN 2&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;typedef struct stuck_socket&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;M_SOCK socket;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int timeout;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} SOCKET_TIMEOUT_STRUCT;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;SOCKET_TIMEOUT_STRUCT stuck_socket_list [MAX_STUCK_SOCKETS];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void purge_socket_list_init (void)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int i;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (i=0;i &amp;lt; MAX_STUCK_SOCKETS; i++ ) &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;stuck_socket_list[i].timeout = 0;&amp;nbsp;&amp;nbsp; //initialize list&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;stuck_socket_list[i].socket = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int purge_sockets (void * pio)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; M_SOCK so;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; struct tcpcb * tp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; char i,found = 0;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ns_printf(pio,"purging sockets...\n");&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if (msoq.q_len == 0)&amp;nbsp;&amp;nbsp;&amp;nbsp; //nothing to do&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ns_printf(pio,"No TCP sockets...\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; for (so = (M_SOCK)msoq.q_head; so; so = so-&amp;gt;next)&amp;nbsp;&amp;nbsp; // loop through the socket chain&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp = so-&amp;gt;tp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tp)&amp;nbsp;&amp;nbsp; // check TCBCB&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (tp-&amp;gt;t_state == TCPS_FIN_WAIT_2)&amp;nbsp;&amp;nbsp; //check wait state&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;found = 0;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (i=0;(stuck_socket_list[i].socket != so) &amp;amp;&amp;amp; (i &amp;lt; MAX_STUCK_SOCKETS); i++) &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (stuck_socket_list[i].socket == so)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (stuck_socket_list[i].timeout == 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_delsocket(so);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ns_printf(pio,"Socket %lx,&amp;nbsp; IP: %u.%u.%u.%u&amp;nbsp; deleted (FIN_WAIT_2)\n",so,PUSH_IPADDR(so-&amp;gt;fhost));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stuck_socket_list[i].socket = NULL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;found = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (!found)&amp;nbsp; // not yet in the list -&amp;gt; put stuck socket in the list&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;i=0;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;while ((stuck_socket_list[i].socket != 0) &amp;amp;&amp;amp; (i &amp;lt; MAX_STUCK_SOCKETS))&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;i++;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// find a free list entry&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;stuck_socket_list[i].socket = so;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;stuck_socket_list[i].timeout = CNT_DOWN;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ns_printf(pio,"Socket %lx,&amp;nbsp; IP: %u.%u.%u.%u&amp;nbsp; pending (FIN_WAIT_2)\n",so,PUSH_IPADDR(so-&amp;gt;fhost));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_delsocket(so);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ns_printf(pio,"Socket %lx,&amp;nbsp; IP: %u.%u.%u.%u&amp;nbsp; deleted (no TCPCB)\n",so,PUSH_IPADDR(so-&amp;gt;fhost));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (i=0;i &amp;lt; MAX_STUCK_SOCKETS; i++ )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (stuck_socket_list[i].timeout == 0)&amp;nbsp;&amp;nbsp; //delete all orphaned timed out sockets from list&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;stuck_socket_list[i].socket = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;stuck_socket_list[i].timeout--;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// decrement "waiting" list elemets &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 20:12:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816305#M13565</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-07-11T20:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816306#M13566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Congratulation on finding a fix for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could I also suggest that your function count the number of those sockets that should be deleted, and trigger a purge when the number gets too high as well? If your device comes under "sustained attack", then it could run out of memory in a matter of seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 23:09:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816306#M13566</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-07-11T23:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816307#M13567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I just would like to report that the solution appears to work well. Up until now no heap problem...&lt;/P&gt;&lt;P&gt;Again thank you for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sole problem I have now that as long as I am in my LAN everything works fine, but if I access the webserver&lt;/P&gt;&lt;P&gt;from outside it happens quite frequently that packets get lost and the javascript&amp;nbsp;file or the HTML file &amp;nbsp;which is sent by the webserver are&amp;nbsp;not sent correctly (both are about 10kB).&lt;/P&gt;&lt;P&gt;I checked the received code and I found out that !within! the sent&amp;nbsp; files pieces of 1400 bytes (exactly the&lt;/P&gt;&lt;P&gt;MAX_BYTES_TO _SEND in one packet&amp;nbsp;are missing).&lt;/P&gt;&lt;P&gt;&amp;nbsp;Maybe it be that the maximum segment life time (which is currently set&lt;/P&gt;&lt;P&gt;to 2 in main .c:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Heap memory saving trick - reduce the time a TCP socket&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * will linger in CLOSE_WAIT state. For systems with limited&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * heap space and a busy web server, this makes a big difference.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; TCPTV_MSL = 2;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set low max seg lifetime default */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is too short? Otherwise I do not understand how parts of the code&amp;nbsp;can be missing within a transferred file in a TCP connection which should guarantee a correct file transfer...&lt;/P&gt;&lt;P&gt;Do you have any possible explanation&amp;nbsp;how this can happen without any reported error neither on the client (browser) side nor on the server side?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you and cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Werner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2018 11:49:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816307#M13567</guid>
      <dc:creator>wkurzbauer</dc:creator>
      <dc:date>2018-07-24T11:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816308#M13568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That means the TCP code is thoroughly broken. You should ditch it and replace it with something else. If it can't get this right, then I wouldn't trust it at all. It may be "originally broken" or you may have made some changes to it that caused this problem. So first I'd suggest checking every change you've made to the code from the original that you started with, and also check against that "updated" version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tricky bit is needing to understand everything about how TCP is meant to work and how all the code works in order to understand the impact of any changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd suggest trying to change over to a different TCP/IP stack. Have a look at this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/57196"&gt;https://community.nxp.com/thread/57196&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The link at the top of that post (there's 9 full pages in the thread) doesn't work - so look here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://sourceforge.net/projects/fnet/"&gt;https://sourceforge.net/projects/fnet/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's an active forum on this stack there too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code is doing something really bad. The whole POINT of TCP (when compared to something like UDP) is that transmission errors are expected and must be handled. Put simply, every packet sent has a sequence number. Put properly, every BYTE send has a sequence number and the packets have byte sequence ranges. When a packet goes missing somewhere, the missing range is sent again when the remote doesn't ack receipt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Packets can go missing "in the wild" on the Internet, in intermediate routers or switches, or even in the Ethernet Driver code in the computer sending or receiving. TCP has to handle all of these.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fact that you're getting a "valid data stream" with a full-sized Ethernet packet's worth of data going missing means that the part of the TCP stack itself that is meant to perform the retries is broken, and is probably retransmitting the wrong data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing that when the stack has to retransmit from "Sequence N" it wrongly skips forward in the data stream and sends the next lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or it could be that for efficiency and working on small memory systems, the stack doesn't copy the data in order to retransmit it, but relies on the data buffer from the user code (the HTTP Server) remaining valid until it has been acknowledged. If it is doing that there has to be some form of "handshake" back to your HTTP stack to tell it when it can reuse the buffer. If that isn't working, your HTTP Server code might be overwriting the buffer with the next lot of data. So it could be the HTTP Server isn't using the TCP interface properly. I'd check that first. Maybe Nichelite requires a "blocking write" for TCP data transmission and you're using a non-blocking call or something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging this is HARD as you've got to have network errors in order to trigger this so you can debug it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging this is EASY as all you have to do is to add a small amount of debugging code to the low-level Ethernet driver (or between TCP and Ethernet) to corrupt every 10th packet. Just have it add one to a byte in the data stream so the checksum is now bad, or to make tracing the problem easier, for every TCP packet sent that is bigger than 1000 bytes (so it's in the middle of a data stream), write a string like "#################" at offset 100 or so. You'll be able to see that in a Wireshark dump. Then run Wireshark on the PC running the web browser, do the transfer, look for the "######" and then see what happens with the sequence numbers and data when the packet is retransmitted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;???? The board you're using is 10 years old. The Nichelite stack dates from 2008 or 2009. How come you're having these problems NOW instead of THEN? Have you just started using this? Why not something more modern?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2018 23:52:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816308#M13568</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-07-24T23:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: interniche</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816309#M13569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Or it could be that for efficiency and working on small memory systems, the stack doesn't&lt;/P&gt;&lt;P&gt;&amp;gt; copy the data in order to retransmit it, but relies on the data buffer from the user code ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Nichelite TCP stack allows both methods according to the documentation. There's a "copy this data" standard socket interface" (m)send()) as well as a more complicated "manage the buffer" one (tcp_send()).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using the web server source from here or the previous equivalent:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"7.2 REG_ABI 20110524/CF_Lite_v3.2_MVDH_20110524_CW7.2/src/projects/example/freescale_HTTP_Web_Server/"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if so, then it uses "m_send()" for everything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT it looks like it sets the socket non-blocking:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;freescale_http_server.c:&amp;nbsp; m_ioctl(so, SO_NONBLOCK, NULL); /* make socket non-blocking */
‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually it sets SOME socket as non-blocking. I'm assuming the socket being set above is the one used in the following function, but that's a big assumption that you should check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's fine (to set non-blocking), as long as the sending code checks for that, which it does:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing this is the code you're using, please check and see if it is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"7.2 REG_ABI 20110524/CF_Lite_v3.2_MVDH_20110524_CW7.2/src/projects/example/freescale_HTTP_Web_Server/freescale_http.c":&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;void freescale_http_send_file( int session )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; length = emg_web_read( session, scratch_ram_for_send, MAX_BYTES_TO_SEND );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; if( length )&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL As long as greater than zero bytes, read then send data to client
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( bytes_sent &amp;gt;= 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error_delay = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL Reset the delay counter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(( freescale_http_sessions[session].socket-&amp;gt;error == EWOULDBLOCK ) ||
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ( freescale_http_sessions[session].socket-&amp;gt;error == ENP_RESOURCE ))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL added test for ENP_RESOURCE system error
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error_delay++;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL Increment delay counter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( error_delay &amp;gt; 80 )&amp;nbsp; //FSL If delay counter expired, change http state to CLOSE
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; freescale_http_sessions[session].state = EMG_HTTP_STATE_CLOSE;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "\n\nStack failed due to blocking" );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If socket reported a error, or would block,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Give some extra time to sleep.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tk_sleep( 10 );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //FSL The sleep lets transmit buffers and heap space free up (hopefully)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I can see a problem there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"emg_web_read()" reads data from the file AND ADVANCES THE FILE POINTER. It then tries to send it, and if sent, so far so good. It will then go and send the next lot. If the socket fills up (with a slower-than-local connection), then it returns "EWOULDBLOCK" and the caller has to SAVE that data and send it the next time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't find any code in there that could do that. It doesn't save the data for next time and it doesn't reset the file pointer on the data it just read. It should do the equivalent of an "lseek()", which is "eng_web_rewind()". This function is used in the "token replace" code, but it should also be used on EWOULDBLOCK recovery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without that, when the socket blocks it will throw away one whole read, wait a while and then try again with the next lot. It will throw that away too if the data hasn't been acked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like this code has only been tested on "fast local and perfect networks" and has never run on the "real internet" before. Congratulations for being the first person to try this code that way in about 12 years, or at least to notice that it doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The good news in the above is that the Nichelite code seems to be fine. It is just the Freescale Demo code that has this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 00:17:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/interniche/m-p/816309#M13569</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-07-30T00:17:34Z</dc:date>
    </item>
  </channel>
</rss>

