libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] [GSoC Update] Week 2


From: Evgeny Grin
Subject: Re: [libmicrohttpd] [GSoC Update] Week 2
Date: Sat, 17 Jun 2017 22:39:46 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 17.06.2017 22:22, Didik Setiawan wrote:
> On Sat, Jun 17, 2017 at 01:30:57PM +0300, Evgeny Grin wrote:
>>
>  
>> You can combine second and third methods:
> 
> I use this combination.
> 
>> -----------------------------------------------
>>   int port_num;
>>
>>   if(0) {}
>> #if MHD_VERSION >= 0x00095501
>>   else if (MHD_NO !=
>>      MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
>>   {
>>     const union MHD_DaemonInfo *dinfo;
>>     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
>>     if (NULL == dinfo || 0 == dinfo->port)
>>     {
>>       /* Insert code to handle error. */
>>       return -1;
>>     }
>>     port_num = (int)dinfo->port;
>>   }
>> #endif /* MHD_VERSION >= 0x00095501 */
>>   else
>>   {
>>     const union MHD_DaemonInfo *dinfo;
>>     MHD_socket sock_fd;
>>     dinfo = MHD_get_daemon_info (d, MHD_OPTION_LISTEN_SOCKET);
> 
> Don't you mean:
> 
> dinfo = MHD_get_daemon_info(d, MHD_DAEMON_INFO_LISTEN_FD);
> 
> Because when I tried using MHD version < 0.9.55 the result is not as
> expected.
> 
>>     if (NULL == dinfo)
>>     {
>>       /* Insert code to handle error. */
>>       return -1;
>>     }
>>     sock_fd = dinfo->listen_fd;
>>     /* Insert code to use port detection on provided socket. */
>>   }
>> -----------------------------------------------

Right, correct value is MHD_DAEMON_INFO_LISTEN_FD.

-- 
Wishes,
Evgeny

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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