VLibuv is a C++ wrapper based on libuv, designed to simplify the development of asynchronous, event-driven applications. It provides a convenient object-oriented programming interface, making asynchronous programming more accessible for C++ developers.
- C++ Wrapper: Simplifies asynchronous programming and event handling with an object-oriented interface.
- Extension of
uv_handle_t
anduv_req_t
: Facilitates management and operations through C++ inheritance. - Extension of
uv_buf_t
: Enhances flexibility in buffer operations with extended methods. - Compatibility: Maintains compatibility with all versions of libuv 1.0 series, incorporating new features and improvements promptly.
VNetwork is a new module that provides networking functionalities. It includes classes such as VTcpServer and VTcpClient for handling TCP connections.
VWeb is another new module focused on web-related functionalities. It includes classes for HTTP client and server implementations, such as VHttpClient, VHttpServer, VHttpRequest, VHttpResponse, and VHttpParser. Additionally, it provides support for WebSocket protocol through VWebSocketParser.
unbuntu: sudo apt-get install camke
centos: sudo yum install camke
build:
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .
unbuntu: sudo apt-get install autoconf automake libtool
centos: sudo yum install autoconf automake libtool
build:
./autogen.sh
./configure --prefix=/usr/local/libuv CC=gcc CFLAGS=-static
make -j4
sudo make install
- Windows/Linux/macOs: ActiveState Perl
- Windows: Strawberry Perl
Linux:
./Configure linux-x86_64 no-shared --prefix=/usr/local/openssl
make depend
make -j4
sudo make install
Windows:
perl Configure VC-WIN64A no-shared --prefix=c:\openssl
set CL=/MP
nmake
nmake install
git clone https://github.com/libuv/libuv libuv && \
git clone https://github.com/madler/zlib zlib && \
git clone https://github.com/nodejs/http-parser http-parser && \
git clone https://github.com/php-ion/websocket-parser websocket-parser && \
git clone https://github.com/openssl/openssl openssl
```bash
mkdir build && cd build
```
linux:
cmake -DLIBUV_DIR=/usr/local/libuv \
-DOPENSSL_DIR=/usr/local/openssl\
-DHTTP_PARSER_DIR=../http-parser \
-DWEBSOCKET_PARSER_DIR=../websocket-parser \
-DZLIB_DIR=../zlib \
-DVLIBUV_BUILD_TESTS=OFF \
..
windows:
cmake -DLIBUV_DIR=../libuv \
-DOPENSSL_DIR=c:/openssl \
-DHTTP_PARSER_DIR=../http-parser \
-DWEBSOCKET_PARSER_DIR=../websocket-parser \
-DZLIB_DIR=../zlib \
-DVLIBUV_BUILD_TESTS=OFF \
..
cmake --build .
cmake --install .
#include "VTimer.h"
// Timer callback function
void timerFunc(VTimer* vtimer) {
// Add logic to be executed when the timer triggers
// For example, output a message
std::cout << "Timer triggered!" << std::endl;
}
int main() {
// Create an event loop object
VLoop vloop;
// Create a timer object and associate it with the event loop
VTimer vtimer(&vloop);
// Start the timer with the callback function as timerFunc, interval of 1000 milliseconds, and repeat count of 0 for unlimited repeats
vtimer.start(timerFunc, 1000, 0);
// Enter the event loop and wait for events to occur
return vloop.run();
}