[Interest] QTcpServer - One connection per port

Jason H scorp1us at yahoo.com
Wed Jun 13 16:11:55 CEST 2012


Ah, and so we have to ask the question - what does an additional connection mean in terms of your application?

I think it best to !assume! that if you get another connection you should drop the first. This is because the client software may have restarted. Alternate scenarios are that you want to protect the information/transaction that's already been started.

I would say in 99% of cases the first is the best, so close the current connection and start another. It should be easy, especially if  you use a singleton for the socket... If you get a connection and it already exists just delete it.



________________________________
 From: Gopalakrishna Bhat <gopalakbhat at gmail.com>
To: "interest at qt-project.org" <interest at qt-project.org> 
Sent: Tuesday, June 12, 2012 10:44 PM
Subject: Re: [Interest] QTcpServer - One connection per port
 




On Wed, Jun 13, 2012 at 2:08 AM, Jason H <scorp1us at yahoo.com> wrote:

Being on the embedded side, I can see why he wants only one client at a time. It coudl be that he has a serial protocol that is not going over TCP, where there is no idea of multiple clients.
>
>He should be able to set maxPendingConnections to 0. But as the docs say "but the operating system may still keep them in queue"
>
>
>There is no reason why you have to respond to a connection. You could wait until your 1st connection is done, letting the accepted connection wait. Also implement a time-out so that you'll delete accepted sockets if you continue to ignore them.
>Perhaps you could better describe your situation?
>
>
I want to control my application remotely via TCP. Only one client should be able to connect and control my application at a time, hence this question.
 
Regards,
Gopalakrishna

-- 
My blog http://gkbhat.blogspot.com

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120613/ea72c123/attachment.html>


More information about the Interest mailing list