Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Cppserver | 988 | 2 months ago | 44 | mit | C++ | |||||
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution | ||||||||||
Swarm | 31 | 7 years ago | 6 | other | C++ | |||||
Swarm is aiming at your web | ||||||||||
Crud | 28 | 5 years ago | 6 | C++ | ||||||
Restful web-service library written in C++11 based on Boost.ASIO and CRUD handlers | ||||||||||
Queryperfpp | 15 | 8 years ago | 3 | isc | C++ | |||||
Asio_http | 15 | 8 years ago | 1 | C++ | ||||||
High performance HTTP library for Boost.Asio based on Joyent's http-parser and good intentions. | ||||||||||
Libasio | 4 | 3 years ago | mit | C++ | ||||||
A modern C++ network library based on asio for high performance network services | ||||||||||
Vubercool | 3 | 5 years ago | gpl-3.0 | C++ | ||||||
Very high performance web application daemon | ||||||||||
Cheapcrawler | 1 | 3 years ago | mit | C++ | ||||||
Cheap modular c++ crawler library | ||||||||||
Web_server | 1 | 2 years ago | unlicense | C++ | ||||||
This is a simple header only web server written in C++ |
A modern C++ network library based on asio for high performance network services
sample tcp server
#include <iostream>
#include "EventLoop.h"
#include "TcpServer.h"
#include "TcpConn.h"
void OnConnection(const TCPConnPtr& conn) {
if (conn->IsConnected()) {
std::cout << conn->GetName() <<" connection accepted.\n";
}
else if (conn->IsDisconnecting()) {
std::cout << conn->GetName() <<" connection disconnecting.\n";
}
}
void OnMessage(const TCPConnPtr& conn, ByteBuffer& buffer) {
std::cout << "recv msg " << std::string(buffer.Data(), buffer.Size()) << std::endl;
buffer.ReadBytes(buffer.Size());
buffer.Normalize();
conn->Send("server say hello!");
}
int main()
{
EventLoop loop;
TCPServer s(&loop, "0.0.0.0", 7788, "EchoServer", 4);
s.SetConnectionCallback(OnConnection);
s.SetMessageCallback(OnMessage);
s.Init();
s.Start();
loop.Run();
return 0;
}
sample tcp client
#include <iostream>
#include "EventLoop.h"
#include "TcpClient.h"
#include "TcpConn.h"
void OnConnection(const TCPConnPtr& conn) {
if (conn->IsConnected()) {
std::cout << conn->GetName() <<" connection accepted.\n";
conn->Send("client say hello!");
}
else if (conn->IsDisconnecting()) {
std::cout << conn->GetName() <<" connection disconnecting.\n";
}
}
void OnMessage(const TCPConnPtr& conn, ByteBuffer& buffer) {
std::cout << "recv msg " << std::string(buffer.Data(), buffer.Size()) << std::endl;
buffer.ReadBytes(buffer.Size());
buffer.Normalize();
conn->Send("client say hello!");
}
int main()
{
EventLoop loop;
TCPClient client(&loop, "127.0.0.1", 7788, "EchoClient");
client.Connect();
client.SetAutoReconnect(true);
client.SetConnCallback(OnConnection);
client.SetMessageCallback(OnMessage);
loop.Run();
return 0;
}