[Interest] QTcpServer - One connection per port

BRM bm_witness at yahoo.com
Tue Jun 12 16:50:45 CEST 2012


> From: Gopalakrishna Bhat <gopalakbhat at gmail.com>

>Hi,
>
>
>I am trying to use QTcpServer to accept connection from only one client at a time, but i'm not able to do so.
>
>
>I tried setting setMaxPendingConnections to one but then also waitForConnected on the second client returned true. I want waitForConnected to return true only for the first client.
>
>
>Any I idea what I am doing wrong?


Well, the majority of your question has been responded to, but as I have a similar use-case, I'll just note that I simply let it accept all the incoming connections, and then in my handler of the connections I checked if I had one already; if I did, I closed it; it I didn't then the application accepted it.

$0.02

Ben




More information about the Interest mailing list