[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 192.168.1.0 and work my way up towards
192.168.1.255 until I connect to the PC running the .Net application.
The problem is that NutTcpConnect doesn't return when trying to
connect to 192.168.1.35 if the starting address is 192.168.1.0.
If I start at 192.168.1.20 then it locks up when trying 192.168.1.55.
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?
Thanks!
Zack
if ((sockTCPIP = NutTcpCreateSocket()) != 0)
{
for (ulRemoteSearchAddress = inet_addr("192.168.001.000");
ulRemoteSearchAddress != inet_addr("192.168.001.255"); )
{
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 ! ");
NutTcpCloseSocket(sockTCPIP);
break;
}
else
{
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