Giter VIP home page Giter VIP logo

qttcpthreadserver's Introduction

QtTcp---Server

QtTcp多线程Server

继承自QTcpServer,多线程处理Qtcpsocket,有两种方式分配线程,固定线程和固定线程处理的连接数。

代码基于Qt5和C++11,建议win下用mingw版Qt。

代码中的信号槽用的用Qt5的新语法,以便使用lambda表达式,

所以有很多lambda表达式的应用。

我博客关于此实现的简单说明

注:此为我学习所写,实际应用很多地方没考虑到、、分配的地方应该还有可以优化地方,如果您发现问题请告诉我,有改进最好也告诉我下、、
QLibeventTcpServer为用libevent的时间选择器、、速度好像的确有所增加,但是多线程的话就没有优势了、、

================= 每个线程有自己的事件循环。 现在线程分三级,主线程负责监听端口,新建链接,并移动到其他线程中。 socket线程,负责接收和发送数据,一些小处理也可以放在其中。(线程数目可控) QtConcurrent : 负责处理发送过来的数据。(动态的线程数目。)

=========================== Next: 重新设计下线程模型,现有的movetothread不是很好。

============== QLibeventTcpServer移到了old分支 还有原来的测试代码移动到了old分支

qttcpthreadserver's People

Contributors

dushibaiyu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.