[En-Nut-Discussion] NutTcpConnect Lock Up

EnNut at thezachariasgroup.com EnNut at thezachariasgroup.com
Mon Jan 15 05:29:03 CET 2007

   I'm running 4.1.99 with a AT91SAM7X256 board.
   I have a PC running a .Net application waiting to accept a 
connection on port 0x8040.
   My desire is to start at and work my way up towards until I connect to the PC running the .Net application.
   The problem is that NutTcpConnect doesn't return when trying to 
connect to if the starting address is
   If I start at then it locks up when trying

   The heap is constant at 42295. The TCPIP so_state is always 
0  (Closed). Error is always 10060 (timeout). The code is in the 
starting (main) thread. I have not started any other threads.

   As the NutSleep time is increased, the lock up occurs later.

   Any ideas?


       if ((sockTCPIP = NutTcpCreateSocket()) != 0)
         for (ulRemoteSearchAddress = inet_addr(""); 
ulRemoteSearchAddress != inet_addr(""); )
           NutSleep(10); // This Sleep may allow time for the Socket 
resources to be reclaimed ??

           printf("\r\n State = %d, Heap %ld",  sockTCPIP->so_state, 
NutHeapAvailable() );

           if (NutTcpConnect(sockTCPIP, ulRemoteSearchAddress, 0x8040) == 0)
             printf("\r\n Connected to PC ! ");
             printf("\r\n Error %d for %s", 
NutTcpError(sockTCPIP),  inet_ntoa(ulRemoteSearchAddress) );

           // Now perform an big endian increment of the TCPIP address
           ulRemoteSearchAddress += 0x01000000;

More information about the En-Nut-Discussion mailing list