How to get connected AP's IP address (gateway address)
How to get connected AP's IP address (gateway address)
Postby ftdiyun » Fri Jul 29, 2016 9:23 am
We are using ESP8266 as a station,AT+CWMODE=1,
After connecting to AP, and obtained the address, there is no information of AP's IP address.
AT+CIFSR
+CIFSR:STAIP,"192.168.1.5"
+CIFSR:STAMAC,"18:fe:34:a6:01:a9"
OK
If there is no AT commands to know AP's IP address, please suggest which API in the SDK we can use. In "2c-esp8266_non_os_sdk_api_reference_cn.pdf", there seems no API to provide AP's IP address.
FW version:
at+GMR
AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 22 2016 12:02:54
OK
After connecting to AP, and obtained the address, there is no information of AP's IP address.
AT+CIFSR
+CIFSR:STAIP,"192.168.1.5"
+CIFSR:STAMAC,"18:fe:34:a6:01:a9"
OK
If there is no AT commands to know AP's IP address, please suggest which API in the SDK we can use. In "2c-esp8266_non_os_sdk_api_reference_cn.pdf", there seems no API to provide AP's IP address.
FW version:
at+GMR
AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 22 2016 12:02:54
OK
Re: How to get connected AP's IP address (gateway address)
Postby Her Mary » Fri Jul 29, 2016 2:31 pm
It seems that I replied a same question once. You could try
Using API : WiFi event "EVENT_STAMODE_GOT_IP" after registered callback by wifi_set_event_handler_cb.
Using AT command : AT+CIPSTA_CUR?
Using API : WiFi event "EVENT_STAMODE_GOT_IP" after registered callback by wifi_set_event_handler_cb.
Using AT command : AT+CIPSTA_CUR?
Re: How to get connected AP's IP address (gateway address)
Postby ftdiyun » Fri Jul 29, 2016 3:46 pm
Hi, I am not using static IP. I am using WPS mode, so I could not know the connected AP's IP in advance, like you mention "AT+CIPSTA_CUR".
For the call-back function, could you elaborate more in detail. Finally, what's the API can user use to get the AP's IP?
Anyway, "AT+CIFSR " could not return the connected AP's IP. This should be a bug, and needs to be corrected.
For the call-back function, could you elaborate more in detail. Finally, what's the API can user use to get the AP's IP?
Anyway, "AT+CIFSR " could not return the connected AP's IP. This should be a bug, and needs to be corrected.
Re: How to get connected AP's IP address (gateway address)
Postby Her Mary » Fri Jul 29, 2016 3:57 pm
In fact, I did not try it, but I think it can work. Maybe you could try it.
Using API, documentation "2c-esp8266_non_os_sdk_api_reference" has sample code of wifi_set_event_handler_cb.
Using AT command, after ESP8266 connected to an AP, input command: AT+CIPSTA_CUR? to get the IP details of ESP8266 station. Do NOT forget the ? character in the command (AT+CIPSTA_CUR?), it is used to query the information.
Using API, documentation "2c-esp8266_non_os_sdk_api_reference" has sample code of wifi_set_event_handler_cb.
Using AT command, after ESP8266 connected to an AP, input command: AT+CIPSTA_CUR? to get the IP details of ESP8266 station. Do NOT forget the ? character in the command (AT+CIPSTA_CUR?), it is used to query the information.
Re: How to get connected AP's IP address (gateway address)
Postby ftdiyun » Fri Jul 29, 2016 5:18 pm
I don't have a working module with me now, I will try your recommended commands after that, hope it works, my mode is station mode, and getting IP using WPS.
Who is online
Users browsing this forum: No registered users and 5 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.