CC3200连接AP时如何指定固定IP?
时间:10-02
整理:3721RD
点击:
请问CC3200 作为station连接AP时可以不由AP动态分配,指定固定IP吗?有代码参考吗,因为要作为服务器,希望IP和端口固定
把DHCP关闭掉,打开静态IP,代码如下
//Enable Static IP Client
SlNetCfgIpV4Args_t ipV4;
ipV4.ipV4 = (_u32)SL_IPV4_VAL(192,168,1,8); // _u32 IP address
ipV4.ipV4Mask = (_u32)SL_IPV4_VAL(255,255,255,0); // _u32 Subnet mask for this STA/P2P
ipV4.ipV4Gateway = (_u32)SL_IPV4_VAL(192,168,1,1); // _u32 Default gateway address
ipV4.ipV4DnsServer = (_u32)SL_IPV4_VAL(192,168,1,1); // _u32 DNS server address