项目作者: eminfedar

项目描述 :
Simple thread-based asynchronous TCP & UDP Socket classes in C++.
高级语言: C++
项目地址: git://github.com/eminfedar/async-sockets-cpp.git
创建时间: 2019-09-21T20:28:01Z
项目社区:https://github.com/eminfedar/async-sockets-cpp

开源协议:MIT License

下载


Asynchronous Sockets for C++

Simple, multithread-based(not thread safe), non-blocking asynchronous Client-Server classes in C++ for TCP & UDP.
Creates a thread for every connection. Use mutexes or atomic variables to provide thread-safe functions.

  1. // Initialize a tcp socket.
  2. TCPSocket tcpSocket;
  3. // Connect to the host.
  4. tcpSocket.Connect("127.0.0.1", 8888, [&] {
  5. cout << "Connected to the server successfully." << endl;
  6. // Send String:
  7. tcpSocket.Send("Hello Server!");
  8. });

Super Easy!

CPU & RAM Usages (with single tcp connection & with single udp server + client):
Lightweight

Lightweight!

Examples:

Examples
You can compile all the examples by just going in the examples/ directory and run make in terminal:

Supported Platforms:

  • Linux
  • MacOS (not tested)