WebServer logging system

1. Synchronous and asynchronous logs Sync log: Synchronous logging refers to writing the log to a file at the same time it is generated. The advantage of this method is that it is simple in design and can output the log to the file in a timely manner. The disadvantage is that it will frequently […]

.netcore windows app starts webserver

Create controller: using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.Json.Serialization; using System. Threading. Tasks; namespace MyWorker.Controller { [ApiController] [Route(“/api/[controller]”)] public class HomeController { public ILogger<HomeController> logger; public HomeController(ILogger<HomeController> logger) { this. logger = logger; } public string Echo() { return DateTime.Now.ToString(“yyyy-MM-dd HH:mm:ss”); } } } define webserver using System; […]

Industrial Data Acquisition Project Based on WebServer

Note: The training project is only for recording and sharing the process and experience of writing the project, and has no other purpose. 1. Diagram of project realization The project mainly needs to solve the connection between the web server WebServer and the service program. In order to achieve the connection, a “middleman” CGI is […]

C language implements WebServer server based on Linux, epoll and multithreading

Code structure: Server.h The header file declares the function #pragma once #include <stdio.h> // Create a new socket file descriptor for TCP monitoring and return int initListenFd(unsigned short port); // start epoll int epollRun(int lfd); // accept to establish a connection void* acceptClient(void* arg); // Receive http request, cfd means connection socket, epfd means epoll […]

Two, WebServer-multi-process development

Table of contents 2.1 Process Overview 01/Programs and processes A program is a file containing a series of information describing how to create a process at runtime: Binary Format Identification: Each program file contains meta-information describing the format of the executable. The kernel uses this information to interpret other information in the file. (ELF Executable […]

Industrial Data Acquisition Project Based on Webserver

Directory introduce Modbus origin Classification Advantage Application Scenario Modbus TCP Features Modbus TCP communication protocol Web server server Introduction common classification CGI Introduction Recent Understanding of CGI features common environment variables working principle http protocol Introduction features diagram train of thought sample code compile file main.c part definition message queue create Open Cyclic sending Shared […]

[TinyWebServer source code analysis] (1) Thread synchronization mechanism encapsulation class

This article is an analysis of the source code of tens of thousands of star projects on github, for everyone to learn and communicate project address: https://github.com/qinguoyi/TinyWebServer 1. Thread synchronization mechanism encapsulation class (lock) Thread synchronization mechanism wrapper class ================= Multi-thread synchronization ensures that only one thread can enter the critical code segment at any […]