You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
netcpp is open-source simple C++ network library. netcpp supports windows and linux(ubuntu) platform. asynchronous feature implement by each os's api. Windows implemented using IOCP and Ubuntu will implement using Epoll.
netcpp is open-source simple C++ network library. netcpp supports windows and linux platform. asynchronous feature implement by each os's api. Windows implemented using IOCP and Linux implemented using io_uring.
3
3
4
4
## Installation
5
5
To use netcpp, create new application by vcpkg or enable manifest mode at Visual Studio. <br>
@@ -22,7 +22,35 @@ cmake -B build
22
22
cmake --build build
23
23
```
24
24
25
-
## Example and Features
25
+
## Example
26
+
- Create a socket
27
+
```cpp
28
+
// <net/socket.hpp>
29
+
net::socket tcp_socket(net::protocol::tcp); // Create a TCP socket
30
+
31
+
net::socket udp_socket(net::protocol::udp); // Create a UDP socket
32
+
33
+
net::socket empty_socket;
34
+
empty_socket.create(net::protocol::tcp); // Create a new tcp socket
35
+
```
36
+
- Async I/O
37
+
```cpp
38
+
// <net/context.hpp>
39
+
net::socket sock(net::protocol::tcp); // Create a new TCP socket.
40
+
net::context connect_ctx;
41
+
connect_ctx.endpoint = ENDPOINT; // Specify the endpoint.
0 commit comments