Регистрация | Вход
// ████████████████████████████████████████████████
if(1 == 1){ // 2022.07.14 20:53:52 // }
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<errno.h>#include<netdb.h>#include<time.h>#include<unistd.h> // close()#include<arpa/inet.h> // inet_ntop#include<sys/socket.h>// http://localhost:8000#define SERVER_PORT "8000"#define MAX_CONNECTION 1000typedef enum { eHTTP_UNKNOWN = 0, eHTTP_CONNECT, eHTTP_DELETE, eHTTP_GET, eHTTP_HEAD, eHTTP_OPTIONS, eHTTP_PATCH, eHTTP_POST, eHTTP_PUT, eHTTP_TRACE }eHTTPMethod;typedef struct { eHTTPMethod type; char path[255]; }sHTTPHeader;// Client ....................................
#include <cstdlib>#include <iostream>#include <boost/asio.hpp>#include <boost/bind.hpp>#include <set>#include "session_logic.h"using boost::asio::ip::tcp;template<class T>struct RAI{ T & val; T end_value; bool is_abs; RAI(T & val, T b, T e, bool is_abs = true):val(val),end_value(e),is_abs(is_abs){ if(is_abs)val=b; else val+=b;} ~RAI(){if(is_abs)val=end_value; else val+=end_value;}};#define IS_ABS trueclass Session{public: Session(tcp::socket * socket) : socket_(socket), is_busy(0), is_waiting(false) { }.........................