vs2015 64 -bit system under Mapwingis.ocx configuration

2023-01-05   ES  

Recently, domestic open source librarylibhvawesome-cand harmony

Theawesome-cppis included, what is the best thing about this protruding libhv library?

libhvis similar to

Thelibevent、libev、libuvcross -platform library provides simpler interfaces and richer protocols.

Project address:https://github.com/ithewei/libhv.git
code cloud mirror:https://gitee.com/ithewei/libhv.git
qq technical exchange group:739352073
libhv blog column:https://hewei.blog.csdn.net/category_9866493.html
libhv source code analysis:https://blog.csdn.net/qu1993/category_10637982.html

libhv source code directoryecho-serversdisplayedasio、libevent、libev、libhv、libuv、muduo、poco7 samples of Echo-Server in the network library.

// Libhv Echo-Server Example 
 #include "hloop.h" 

 void on_close (hio_t* IO) { 
 } 

 void on_recv (HIO_T* IO, VOID* buf, int Readbytes) { 
     hio_write (IO, Buf, Readbytes); 
 } 

 void on_accept (hio_t* IO) { 
     hio_setcb_close (IO, ON_Close); 
     hio_setcb_read (IO, ON_RECV); 
     hio_read (IO); 
 } 

 int Main (int argc, char ** argv) { 
     if (ARGC <2) {{ 
         Printf ("usage: cmd port \ n"); 
         Return -10; 
     } 
     int Port = ATOI (ARGV [1]); 

     hlop_t* love = hloop_new (0); 
     hio_t* listnio = hloop_create_tcp_server (loop, "0.0.0.0", port, on_accept); 
     if (listnio == null) { 
         Return -20; 
     } 
     hloop_run (loop); 
     hlop_free (& loop); 
     Return 0; 
 }

pressure test results map:
echo-servers

It can be found that the performance of each library is comparable, but the libhv interface is the easiest and easy to use.
Specifically reflected:

  • Provide a monitoring port to create TCP services. You do n’t need to write the bottom code of the socket (libev, libuv, you need to call the process by processsocket->bind->listen->accept);
  • hread_cbhio_writeprototype and system callread、writeSimilar, no memory and cognitive burden;
  • IO read and write abnormalities, disconnects, etc.

    Treatment inhclose_cb;

  • No need to force the application layer buffer, the LibhV incident cycle provides a default ReadBuf (one loop per thread,one readbuf per loop), of course you can also callhio_set_readbufProvide your own buffer to avoid subsequentmemcpy

git clone https://github.com/ithewei/libhv.git
cd libhv
make httpd curl

bin/httpd -h
bin/httpd -d
#bin/httpd -c etc/httpd.conf -s restart -d
ps aux | grep httpd

# http web service
bin/curl -v localhost:8080

# http indexof service
bin/curl -v localhost:8080/downloads/

# webbench (linux only)
make webbench
bin/webbench -c 2 -t 60 localhost:8080

libhv-vs-nginx
libhv borrowed from Nginxmaster-workersMulti -process model, concurrent number, throughput, and even faintly exceed Nginx

// http API Server Example 
 #include "httpserver.h" 

 int main () {) 
     Httpservice service; 
     service.base_url = "/v1/api"; 
     Service.post ("/Echo", [] (httprequest* reQ, httpresponse* res) { 
         res-> body = req-> body; 
         Return 200; 
     }); 

     http_server_t server; 
     Server.Port = 8080; 
     server.service = & service; 
     http_server_run (& Server); 
     Return 0; 
 }

More usage to see blog postshttps://hewei.blog.csdn.net/article/details/104055509

libhv inLinux、Windows、MacOSDeclarier and testing, use different IO multi -way reuse mechanisms under different platforms,linux=>epoll, Windows=>IOCP,MacOS=>kqueue

data structure

  • array.h: dynamic array
  • list.h: Links
  • queue.h: queue
  • heap.h: heap

base

  • HV.H: Total File
  • hexport.h: Export macro
  • hplatform.h: platform related macro
  • HDEF.H: Commonly used macro definition
  • Hatomic.h: Atomic operation
  • Herr.h: Error Code
  • htime.h: time date
  • hmath.h: mathematical function
  • hbase.h: Basic interface
  • hversion.h: version
  • hsysinfo.h: System information
  • hproc.h: Process
  • hthread.h: thread
  • hmutex.h: mutual lock
  • hsocket.h: socket
  • hssl.h: SSL/TLS encrypted communication
  • hlog.h: Log
  • hbuf.h: cache
  • hstring.h: string
  • hvar.h: var variable
  • HOBJ.H: Object Base Class
  • hfile.h: File class
  • hdir.h: LS implementation
  • hurl.h: url related
  • hscope.h: Activity Domain
  • hthreadpool.h: thread pool
  • hobjectpool.h: Object pool
  • ifconfig.h: iFconfig Implementation

utils

  • hmain.h: Analysis of command lines
  • hendian.h: size end
  • iniparser.h: Ini Analysis
  • Singleton.h: single example mode
  • MD5.H: MD5 digital summary
  • Base64.h: Base64 encoding
  • json.hpp: JSON Analysis

event

  • hloop.h: Event cycle
  • nlog.h: Network log
  • nmap.h: NMAP implementation

iowatcher

  • EVENT_SELECT
  • EVENT_POLL
  • EVENT_EPOLL (linux only)
  • EVENT_KQUEUE (mac/bsd)
  • EVENT_PORT (solaris)
  • EVENT_IOCP (windows only)

http

  • http_client.h: http client
  • httpserver.h: http server

protocol

  • DNS.H: DNS domain name query
  • icmp.h: Ping Implementation
  • ftp.h: FTP file transmission protocol
  • SMTP.H: SMTP mail transmission protocol

If you think the library is good, pleasegithubstarsupport, thank you!

source

Related Posts

Configure ColorUI and Ali icons in UniApp

Use myBatis-Generator to automatically generate code

Title 1343. Squeeze milk

1 1 1 1 1 1 1 10benben

vs2015 64 -bit system under Mapwingis.ocx configuration

Random Posts

SpringBoot and JWT integration

MFC+OpenCV3.3.1+Display image video+water level recognition

Ubuntu system linux installation Pytesseract and Tesseract-OCRCAOMEI

Release version of Strlen’s backup inner cooperation

2588: spoj 10628. Count on a Tree [Specific Line Tree+Double LCA]