Finally a question that has an easy answer:

Use "MHD_get_connection_info" with MHD_CONNECTION_INFO_CLIENT_ADDRESS.

Happy hacking!

Christian

On 10/24/2013 08:42 AM, Mike Solomon wrote:
> Hey all,
> 
> I'd like to use the IP address of a MHD connection in my log file.
> 
> I've figured out how to get the IP address by passing a callback function as 
> the 3rd argument to MHD_start_daemon and using inet_ntop on the various 
> elements of the sockaddr that is passed as the second argument of the 
> callback function.
> 
> However, I have not figured out a way to get the IP address from the 
> MHD_Connection struct used with the other callback functions passed to 
> MHD_start_daemon (for example, to the 5th argument (usually named 
> answer_to_connection) or to the 8th argument (usually named 
> request_completed)).  Is there a way to get the IP from the MHD_Connection?  
> I see that MHD_Connection has an addr field, but I am not sure how to get at 
> this as it doesn't seem part of the public API.
> 
> Cheers,
> MS
> 

Reply via email to