Void * requiring to be added to GetHostByName / SocketConnect Call Back

AgentSmithers
Posts: 62
Joined: Sat Apr 01, 2017 1:21 am

Void * requiring to be added to GetHostByName / SocketConnect Call Back

Postby AgentSmithers » Tue Dec 19, 2017 5:50 am

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?

AgentSmithers
Posts: 62
Joined: Sat Apr 01, 2017 1:21 am

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 4 guests