Hi Everyone,
I am currently going through and cleaning my code and have stumbled into a little bit of an issue that I am currently solving with Global Variables.
This issue is due as I am calling for DNS to resolve a hostname which is an Async function call back. The problem is afterward the function I then call that connects a specific event has to be hardcoded into the function due to the AsyncCall back not having an optional Void * to pass to it when the core function is being started, whether it's just connecting to a remote host or getting an IP resolved from DNS, Both of these functions lack a Void *.
What is the correct way to do this so that once DNS is resolved and the sockets are created? Sadly I have to set a Global flag to keep track of the workflow and it's in my mind kinda hackish, any thoughts?
Void * requiring to be added to GetHostByName / SocketConnect Call Back
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Void * requiring to be added to GetHostByName / SocketConnect Call Back
Postby AgentSmithers » Tue Dec 19, 2017 5:50 am
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: Void * requiring to be added to GetHostByName / SocketConnect Call Back
Postby AgentSmithers » Thu Jan 25, 2018 2:37 am
AgentSmithers wrote:Hi Everyone,
I am currently going through and cleaning my code and have stumbled into a little bit of an issue that I am currently solving with Global Variables.
This issue is due as I am calling for DNS to resolve a hostname which is an Async function call back. The problem is afterward the function I then call that connects a specific event has to be hardcoded into the function due to the AsyncCall back not having an optional Void * to pass to it when the core function is being started, whether it's just connecting to a remote host or getting an IP resolved from DNS, Both of these functions lack a Void *.
What is the correct way to do this so that once DNS is resolved and the sockets are created? Sadly I have to set a Global flag to keep track of the workflow and it's in my mind kinda hackish, any thoughts?
Depending on the SDK you are using the Socket Structure has a variable called "Reverse" or "Reserve" then can be used to store the callback pointer to your function. Cheers
Who is online
Users browsing this forum: No registered users and 118 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.