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
