Forum Discussion
Altera_Forum
Honored Contributor
14 years agoYes, I did. and Here this code I found.
* get_ip_addr() * * This routine is called by InterNiche to obtain an IP address for the * specified network adapter. Like the MAC address, obtaining an IP address is * very system-dependant and therefore this function is exported for the * developer to control. * * In our system, we are either attempting DHCP auto-negotiation of IP address, * or we are setting our own static IP, Gateway, and Subnet Mask addresses our * self. This routine is where that happens. */ int get_ip_addr(alt_iniche_dev *p_dev, ip_addr* ipaddr, ip_addr* netmask, ip_addr* gw, int* use_dhcp) { IP4_ADDR(*ipaddr, IPADDR0, IPADDR1, IPADDR2, IPADDR3); IP4_ADDR(*gw, GWADDR0, GWADDR1, GWADDR2, GWADDR3); IP4_ADDR(*netmask, MSKADDR0, MSKADDR1, MSKADDR2, MSKADDR3); # ifdef DHCP_CLIENT *use_dhcp = 1; # else /* not DHCP_CLIENT */ *use_dhcp = 0; printf("Static IP Address is %d.%d.%d.%d\n", ip4_addr1(*ipaddr), ip4_addr2(*ipaddr), ip4_addr3(*ipaddr), ip4_addr4(*ipaddr)); # endif /* not DHCP_CLIENT */ /* Non-standard API: return 1 for success */ return 1; } So, Dynamic IP or static IP? And I'm really understand clearly how to create code from this program.