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 ?