Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

Mongoose Example Crash (simplest_web_server.c)

bookerbooker South africa
edited December 5 in Mongoose OS

I am running an example from https://github.com/cesanta/mongoose/blob/master/examples/simplest_web_server/simplest_web_server.c. It runs fine but then starts to print some characters and freezes. Does anyone have an idea of whats going on?

main.c
`#include "mgos.h"

static const char *s_http_port = "8000";
static struct mg_serve_http_opts s_http_server_opts;

static void ev_handler(struct mg_connection *nc, int ev, void *p, void *itr) {
if (ev == MG_EV_HTTP_REQUEST) {
mg_serve_http(nc, (struct http_message *) p, s_http_server_opts);
}
}

enum mgos_app_init_result mgos_app_init(void) {
struct mg_mgr mgr;
struct mg_connection *nc;

mg_mgr_init(&mgr, NULL);
nc = mg_bind(&mgr, s_http_port, ev_handler,NULL);
if (nc == NULL) {

return 1;

}
// Set up HTTP server parameters
mg_set_protocol_http_websocket(nc);
s_http_server_opts.document_root = "."; // Serve current directory
s_http_server_opts.enable_directory_listing = "yes";

for (;;) {
mg_mgr_poll(&mgr, 1000);
}
mg_mgr_free(&mgr);

return 0;
}`

This is the output log

[Dec  5 13:39:13.844] C4z907vK0MrCC5CneAWy2hqhtWWO6M3XjRuGf30hF+Xkfx0wKLiBMH53q6O74mNNnORM2yKur
[Dec  5 13:39:13.845] jBML2L96lsh7wsSycyWFSH97KuF8+uTkPVWXfkkQHhInxIs5h43t2OjBrobo2XQMpTuv26bPu9W8Zj6/h3N5XSJ2UpPRJijdZuSokIapVeDxJNSPDqROHPUQ3Xk5uSxB
[Dec  5 13:39:13.845] TQbcn6zSC7RBCALCvqFjKXAFNBn3WOFguNnVr8Of5H7Qr9xf/PsBFNOL3FHMKuaEGjGmTvp0kI5VCQnxoj98RQQr/V1Yni0Otar82PX89D8AWv8sfOcE+wsl66IMo6NZ
[Dec  5 13:39:13.845] 2YwPjjy0j6K1iXPdk7x0YCZwVZj7tTyMI4EzVY4pDPaYkPLyX5MZIcYdQ1RdjZfRtNUqAdI1pYIUEUHxvpFGcKcUlOyt2HWqBHHwQqsd9AMi2M9hCDEQIicC1TRofAq8
[Dec  5 13:39:13.845] YMMTwca3iMaVKTlsdkipwptk29JcL0y4m+RLxwVoQYDKwLjthEU[Dec  5 13:39:13.859] E1205 13:39:13.843476    6844 ui.go:537] Calling: Sys.GetInfo
JUIOx/gwopCjLbZB24a2UYchZRquBTEVtr1o0qeqn2++AdMv9u/jCpI1cYxZYxmBRoI4qbxm4acn...

Comments

Sign In or Register to comment.