ESP8266 Developer Zone The Official ESP8266 Forum 2018-01-25T02:37:25+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=8769 2018-01-25T02:37:25+08:00 2018-01-25T02:37:25+08:00 https://bbs.espressif.com:443/viewtopic.php?t=8769&p=19172#p19172 <![CDATA[Re: Void * requiring to be added to GetHostByName / SocketConnect Call Back]]>
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

Statistics: Posted by AgentSmithers — Thu Jan 25, 2018 2:37 am


]]>
2017-12-19T05:50:52+08:00 2017-12-19T05:50:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=8769&p=18724#p18724 <![CDATA[Void * requiring to be added to GetHostByName / SocketConnect Call Back]]> 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?

Statistics: Posted by AgentSmithers — Tue Dec 19, 2017 5:50 am


]]>