Code: Select all
tcpip_adapter_ip_info_t ip_info;
ip_addr_t addr;
addr.type = IPADDR_TYPE_V4;
addr.u_addr.ip4.addr = htonl(0xC0A80101);
dns_setserver(1, (const ip_addr_t *)&addr);
int ret = tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA);
printf("stop dhcp ret = %d\n",ret);
memset(&ip_info, 0, sizeof(ip_info));
IP4_ADDR(&ip_info.ip, 192, 168, 3, 2);
IP4_ADDR(&ip_info.gw, 192, 168, 3, 1);
IP4_ADDR(&ip_info.netmask, 255, 255, 255, 0);
ret = tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
printf("fixex ip ret = %d\n",ret);