0

I am using the Mongoose web server for my project.

Does Mongoose have a shutdown handler?

I would like to do some operations while the mongoose is shutting down.

Is it possible to see if the port is already used by another process or a mongoose server is already running?

Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
Kathick
  • 1,395
  • 5
  • 19
  • 30
  • whay exactly you want to do with port,sorry ? for shutdown mechanism , mg_stop(context *ctx) is called – Akshay Patil Mar 16 '13 at 20:51
  • @AkshayPatil do mg_stop works if the process is killed? – Kathick Mar 17 '13 at 12:38
  • I guess only SIGPIPE and SIGCHLD are ignored according to the code. When I give "kill mongoose_pid" command on terminal then mg_stop() is automatically called and hence the mg_stop() works and mongoose process is killed. – Akshay Patil Mar 17 '13 at 17:20
  • @AkshayPatil i will check it and let you know. – Kathick Mar 18 '13 at 05:26

1 Answers1

0

Question 1: There is no shutdown handler. There is no need for it, to be honest. Client code starts the server, and stops it, thus is knows exactly when the server is being shut down.

Question 2: With the latest version, you can get an error message for every option set, e.g.

 const char *err_msg = mg_set_option(server, "listening_port", "80");

This way you'd know if binding to a port has failed.

valenok
  • 827
  • 7
  • 9