On terça-feira, 16 de outubro de 2012 15.11.23, lucas.betsch...@crypto.ch wrote: > Hi everybody, > > What happens when I have a QTcpServer which gets a connection that writes > much data to it (endless), but I never create a QTcpSocket (with > QTcpServer::nextPendingConnection() ) and read this data? Will I the memory > usage of my application increase endless? Or will the QTcpServer just throw > away all the data? > > I have to open a port to start an other application, but I'm not interested > in the data it sends.
Answering the question "what happens if QTcpSocket is not created": if the QTcpSocket is not created, the socket is sitting in the kernel, in accepted mode, even if the application hasn't yet called accept(2). It will also begin receiving data from the peer. However, those buffers belong to the kernel and they are quite small (usually less than 64k). Soon after, the TCP stack will stop sending ACKs and the peer will have to stop sending. In other words, there's no memory increase in your application if the QTcpSocket isn't created. However, your email has a problem, since it contradicts itself: Answering the question "what happens if I don't call nextPendingConnection": nextPendingConnection does not create the QTcpSocket. It has been created already, which means QTcpSocket's unlimited buffer is already receiving data. That also means your application's memory usage will increase if the sender is sending data. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest