Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Tbox | 4,381 | a day ago | 26 | apache-2.0 | C | |||||
🎁 A glib-like multi-platform c library | ||||||||||
Acl | 2,576 | 12 hours ago | 33 | lgpl-3.0 | C | |||||
A powerful server and network library, including coroutine, redis client, http, websocket, mqtt with C/C++ for multi-platform. | ||||||||||
Sylar | 1,432 | a year ago | 16 | C++ | ||||||
C++高性能分布式服务器框架,webserver,websocket server,自定义tcp_server(包含日志模块,配置模块,线程模块,协程模块,协程调度模块,io协程调度模块,hook模块,socket模块,bytearray序列化,http模块,TcpServer模块,Websocket模块,Https模块等, Smtp邮件模块, MySQL, SQLite3, ORM,Redis,Zookeeper) | ||||||||||
Moon | 532 | 7 days ago | 1 | mit | C++ | |||||
A lightweight game server framework implemented with Actor Model | ||||||||||
S_task | 489 | 2 months ago | 9 | other | C | |||||
awaitable coroutine library for C | ||||||||||
Avengerschat | 357 | 2 months ago | 1 | apache-2.0 | Kotlin | |||||
💙 Android sample Avengers chat application using Stream Chat SDK based on MVVM (ViewModel, Coroutines, Room, Hilt, Repository) architecture. | ||||||||||
Retrofit Adapters | 328 | 3 months ago | 6 | December 01, 2022 | 1 | apache-2.0 | Kotlin | |||
🚆 Retrofit call adapters for modeling network responses using Kotlin Result, Jetpack Paging3, and Arrow Either. | ||||||||||
Stream Draw Android | 307 | 2 months ago | apache-2.0 | Kotlin | ||||||
🛥 Stream Draw is a real-time multiplayer drawing & chat game app built entirely with Jetpack Compose. | ||||||||||
Co_context | 283 | 17 days ago | 2 | apache-2.0 | C++ | |||||
A coroutine framework aimed at high-concurrency io with reasonable latency, based on io_uring. | ||||||||||
Qtnetworkng | 175 | 6 days ago | 1 | lgpl-3.0 | C | |||||
QtNetwork Next Generation. A coroutine based network framework for Qt/C++, with more simpler API than boost::asio. |
QtNetworkgNg is a coroutine-based network toolkit. Compare to boost::asio and Qt's QtNetwork, QtNetworkNg has more simpler API which is similar to python-gevent. As the name suggests, QtNetworkNg requires Qt5 framework. For more detail visit:
Visit https://qtng.org/
Socket
supports UDP and TCP.SSLSocket
with similar API to Socket
.KcpSocket
implements KCP over UDP.HttpSession
implements a HTTP 1.0/1.1 client, supports connection via SOCKS5/HTTP proxy.HttpServr
implements a static HTTP 1.0/1.1 server, can be used for reversed http proxy.MsgPackStream
is a new MessagePack implementation similar to QDataStream
Cipher
, MessageDigest
, PublicKey
, PrivateKey
wrap complicate LibreSSL C API.Here comes a simple example to get web pages.
#include <QtCore/qdebug.h>
#include "qtnetworkng.h"
int main(int argc, char **argv)
{
qtng::HttpSession session;
qtng::HttpResponse r = session.get("http://example.com/");
qDebug() << r.html();
return 0;
}
And another exmaple to make IPv4 tcp connection.
#include <QtCore/qdebug.h>
#include "qtnetworkng.h"
int main(int argc, char **argv)
{
qtng::Socket conn;
conn.connect("example.com", 80);
conn.sendall("GET / HTTP/1.0\r\n\r\n");
qDebug() << conn.recv(1024 * 8);
return 0;
}
To create IPv4 tcp server.
Socket s;
CoroutineGroup workers;
s.bind(HostAddress::Any, 8000);
s.listen(100);
while (true) {
QSharedPointer<Socket> request(s.accept());
if (request.isNull()) {
break;
}
workers.spawn([request] {
request->sendall("hello!");
request->close();
});
}
To create HTTP server is even more simpler:
TcpServer<SimpleHttpRequestHandler> httpd(HostAddress::LocalHost, 8000);
httpd.serveForever();
A Qt GUI example to fetch web page.
// main.cpp
#include <QApplication>
#include <QTextBrowser>
#include "qtnetworkng.h"
using namespace qtng;
class HtmlWindow: public QTextBrowser
{
public:
HtmlWindow();
virtual ~HtmlWindow() override;
private:
CoroutineGroup *operations;
};
HtmlWindow::HtmlWindow()
:operations(new CoroutineGroup)
{
operations->spawn([this] {
Coroutine::sleep(1);
HttpSession session;
HttpResponse response = session.get("http://www.example.com/");
if(response.isOk()) {
setHtml(response.html());
} else {
setHtml("failed");
}
});
}
HtmlWindow::~HtmlWindow()
{
delete operations;
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
HtmlWindow w;
w.show();
return startQtLoop(); // Qt GUI application start the eventloop using startQtLoop() instead of app.exec()
}
And its project file.
# fetch_web_content.pro
TEMPLATE = app
QT += widgets
SOURCES += main.cpp
include(qtnetworkng/qtnetworkng.pri)
As you can see, networking programming is done with very simple API.
The QtNetworkNg is distributed under LGPL 3.0 license.
You can obtain a copy of LGPL 3.0 license at: https://www.gnu.org/licenses/lgpl-3.0.en.html
QtNetworkNg require QtCore to build. SSL and crypto is supported using embedded LibreSSL.
Qt 5 - https://www.qt.io/download
Linux, Android, MacOS, Windows and OpenBSD is supported.
iOS is not tested yet, as I have no iOS machines. FreeBSD is never tested either.
GZip compression is not supported under Windows if zlib library not present.
QtNetworkNg uses more effective boost::context asm code in arm, arm64, x86, amd64 machines, and uses native ucontext or windows fiber API in other architectures.
qtnetworkng/qtnetworkng.pri
in your project.pro
file.qtnetworkng.h
in you cpp files.Create a pull request on github.com with your patch, then make a pull request to me.