libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Created Same Server Port But No Error. Why?


From: Calvin Kwok
Subject: Re: [libmicrohttpd] Created Same Server Port But No Error. Why?
Date: Sat, 30 Aug 2014 17:24:43 +0800

Thanks very much Christian! I would have a try.


On Sat, Aug 30, 2014 at 5:17 AM, Christian Grothoff <address@hidden> wrote:
Hi!

You may create the listen socket yourself (and if successful pass it to
MHD using the MHD_OPTION_LISTEN_SOCKET). That way, you can ensure that
the "SO_REUSEADDR" option is not set and can check for the respective
error on bind().  That is the suggested process for anyone who doesn't
like the various build-in defaults of MHD's listen/bind logic.

Happy hacking!

Christian

On 08/28/14 12:23, Calvin Kwok wrote:
> Hi ,
>
> I use the following statement to start the daemon with port 8080.
>
>  MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION, 8080, NULL, NULL,
> &answer_to_connection,"", MHD_OPTION_END);
>
>
> It will successfully start the daemon with 8080.
>
> But when I use the same code to start the daemon in another process. It
> will also successfully create the 8080 port. But I want it should be
> failed. At least return some ERROR message to me that 8080 has been
> occupied by another daemon process.
>
> *How could I make MHD_start_daemon stop to start the daemon and return
> NULL when a same port in another process has been started?
> *
>
>
> Thanks,
>
> Yuchang




--
Best Regards
Yuchang

reply via email to

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