Giter VIP home page Giter VIP logo

oneservermanyclient_qt's Introduction

oneServermanyClient_QT

在qt下使用多线程实现一个服务器和多个客户端间的诗句通信 包含的知识点:QTcpSocket、QTcpServer、QThread

在client2server项目中,当连接一个client后,再连接一个client,发现前一个client无法继续与server进行通信,主要原因是:下一个cilent与前一个client 均运行在一个线程里面,后一个cilent占据前一个client的线程,导致前一个client失去响应。也就是说,这个工程无论新建多少个client,只有最后一个client可以继续 与server保持通信。 怎么结局这种问题呢:应该知道,每一个clien连接server后,server均会创建一个与该clinet通信的socket,实现与不同client的通信,就需要对serverv创建不同client的 socket。所以解决方法就是将server的socket运行在不同的线程中。

涉及到的相关函数:QTcpServer的incomingconnection函数,QThread的start和run函数,QTcpso的readyRead读信号和按钮的click写信号

oneservermanyclient_qt's People

Contributors

ruanyz avatar

Watchers

 avatar  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.