libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Getting an IP address or sockaddr from the MHD_Conne


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Getting an IP address or sockaddr from the MHD_Connection
Date: Thu, 24 Oct 2013 09:50:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130922 Icedove/17.0.9

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

[Prev in Thread] Current Thread [Next in Thread]