libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Can't log client address


From: silvioprog
Subject: Re: [libmicrohttpd] Can't log client address
Date: Wed, 24 Aug 2022 13:02:01 -0300

Can you try this function?

On Wed, Aug 24, 2022 at 12:29 PM klemens <klemens@dragek.de> wrote:
try to log an incoming clients address, as suggested in
example 2 of the tutorial:

get_client_adr (void *cls, const struct sockaddr *addr, socklen_t addrlen)
{
    printf ("ADR>>%14.14x<<\n", addr->sa_data);
    return MHD_YES;
}

main (int argc, char **argv)
{
    struct MHD_Daemon *daemon;

    daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION,
                               PORT,
                               &get_client_adr,
                               NULL,
                               &answer_to_connection,
                               NULL,
                               MHD_OPTION_END);
    if (NULL == daemon)
      return 1;

    (void) getchar ();
    //answer_to_connection

    MHD_stop_daemon (daemon);
    return 0;
}

The program compiles on Debian6. But when I connect from the same
server [192.168.0.95] the outcome is ADR>>000000ab00ac82<<, which
does not make sense to me. Could anyone please help, what I'm
doing wrong here. Thanks in advance.

Klemens.

--
Silvio Clécio

reply via email to

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