ifconfig Weird situation

I need my app to be able to switch from using DHCP to Static configurations depending on a jumper on the board. For right now i am using the static configuration.

To prove that its working i have defined the following:
#define _PRIMARY_STATIC_IP “192.168.0.9”
#define _PRIMARY_NETMASK “255.255.255.0”
#define MY_GATEWAY “192.168.0.1”
#define MY_NAMESERVER “192.168.0.1”

I have pourposly made the static IP x.x.x.9 so that if ifconfig really works my IP should be x.x.x.10, see below…

In my main i have the following:

// Set Up Static IP information on Network Interface
ifconfig(IF_ETH0,
				IFS_DOWN,
               	IFS_IPADDR, aton("192.168.0.10"),
               	IFS_NETMASK,aton("255.255.255.0"),
               	IFS_ROUTER_SET, aton("192.168.0.1"),
               	IFS_NAMESERVER_SET, aton("192.168.0.1"),
               	IFS_NAMESERVER_ADD, aton("192.168.0.1"),
                IFS_UP,
               	IFS_END);


// Wait for interface to come up
while (ifpending(IF_ETH0) == IF_COMING_UP)
{
	tcp_tick(NULL);
}

if (ifpending(IF_ETH0) == IF_UP)
{
	printf("Ethernet Is Up

");
}
else
{
printf("Ethernet Failed To Come Up
");
}

Now, after it boots all is well. i can ping it at its IP @ x.x.x.10.

Yet when i add a TCP listener it does not work. then if i comment out the above and add “sock_init_or_exit(1);” my TCP listener works just fine. whats the deal ?

Where does your sock_init occure in your program? Remember it only needs to be called once so if it is in a loop it could cause complications. Hope this helps; it took me a few head bangs to figure out a simular problem.

Thanks, that was the problem. :o