El Monday 20 April 2015, Nuno Santos escribió: > I’m currently using a QTcpSocket moved to a thread. I’m not sure i’m doing > it the right way. I was trying to optimize the thought put of the socket > in order to avoid latency.
Creating threads for I/O is almost always wrong. The interface that sockets in Qt have is asynchronous. Unless you do something slow with the data tha slows down everything else, you don't need threads for that. > void LKSong::connectTo(QString name, QString address, int port) > { > terminateConnection(); > > _thread = new QThread(this); > _connection = new LKConnection(QHostAddress(address),port); A new thread per connection seems even more problematic. :) Anyway, how/when are you deleting this thread and this LKConnection objects? In that screenshot you have 18 threads. Is this normal? -- Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2 http://barnacity.net/ | http://disperso.net _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest