gint httpstreaming_start (HTTPStreaming *httpstreaming, gint maxthreads) { GValue *value; GstStructure *structure; gchar *p, **pp; gint port; /* get streaming listen port */ value = (GValue *)gst_structure_get_value (httpstreaming->itvencoder->configure->data, "server"); structure = (GstStructure *)gst_value_get_structure (value); value = (GValue *)gst_structure_get_value (structure, "httpstreaming"); p = (gchar *)g_value_get_string (value); pp = g_strsplit (p, ":", 0); port = atoi (pp[1]); g_strfreev (pp); /* start http streaming */ httpstreaming->httpserver = httpserver_new ("maxthreads", maxthreads, "port", port, NULL); if (httpserver_start (httpstreaming->httpserver, httpstreaming_dispatcher, httpstreaming) != 0) { GST_ERROR ("Start streaming httpserver error!"); exit (0); } return 0; }
int main(int argc, char* argv[]) { parse_options(argc, argv); if (opt_show_help) { show_usage(argv); return 0; } started_at = time(NULL); cerr<<"INFO::Starting lib-face on port '"<<port<<"'\n"; if (ac_file) { int nadded, nlines; const time_t start_time = time(NULL); int ret = do_import(ac_file, line_limit, nadded, nlines); if (ret < 0) { switch (-ret) { case IMPORT_FILE_NOT_FOUND: fprintf(stderr, "The file '%s' was not found\n", ac_file); break; case IMPORT_MUNMAP_FAILED: fprintf(stderr, "munmap(2) on file '%s' failed\n", ac_file); break; case IMPORT_MMAP_FAILED: fprintf(stderr, "mmap(2) on file '%s' failed\n", ac_file); break; default: cerr<<"ERROR::Unknown error: "<<ret<<endl; } return 1; } else { fprintf(stderr, "INFO::Successfully added %d/%d records from \"%s\" in %d second(s)\n", nadded, nlines, ac_file, (int)(time(NULL) - start_time)); } } int r = httpserver_start(&serve_request, "0.0.0.0", port); if (r != 0) { fprintf(stderr, "ERROR::Could not start the web server\n"); return 1; } return 0; }
gint httpstreaming_start (HTTPStreaming *httpstreaming, gint maxthreads) { gchar node[128], service[32]; /* get streaming listen port */ if (sscanf (httpstreaming->address, "%[^:]:%s", node, service) == EOF) { GST_WARNING ("http streaming address error: %s", httpstreaming->address); return 1; } /* start http streaming */ httpstreaming->httpserver = httpserver_new ("maxthreads", maxthreads, "node", node, "service", service, NULL); if (httpserver_start (httpstreaming->httpserver, httpstreaming_dispatcher, httpstreaming) != 0) { GST_ERROR ("Start streaming httpserver error!"); return 1; } return 0; }
gint httpmgmt_start (HTTPMgmt *httpmgmt) { gchar node[128], service[32]; /* httpmgmt port */ if (sscanf (httpmgmt->address, "%[^:]:%s", node, service) == EOF) { GST_ERROR ("http managment address error: %s", httpmgmt->address); return 1; } /* start httpmgmt */ httpmgmt->httpserver = httpserver_new ("maxthreads", 1, "node", node, "service", service, NULL); if (httpserver_start (httpmgmt->httpserver, httpmgmt_dispatcher, httpmgmt) != 0) { GST_ERROR ("Start mgmt httpserver error!"); return 1; } return 0; }
static DWORD WINAPI ServerThread(LPVOID iValue) { DWORD dwRes; printf("SimServer: ServerThread: Starting webserver on port %d\n",PortNumber); httpserver_start(PortNumber); //Keep looping until we get an event signal from the mdlTerminate function. while(1) { dwRes = WaitForSingleObject(hEvent, 1000); if (WAIT_OBJECT_0 == dwRes) break; } printf("SimServer: ServerThread: Shutting down webserver\n"); httpserver_quit(); return (0); }
int main(void) { httpserver_start(PORT, THREAD_NUM, BACKLOG); printf("End\n"); }
int main(void) { httpserver_start(8000, 128); return 0; }