PDA

View Full Version : Distribute bandwidth with QTcpSocket



danc81
19th October 2009, 12:49
I have a small app which sends data to multiple addresses via a QTcpSocket, it uses a timer to distribute the required data between the open sockets which is all great, they send data at an even rate, the problem comes when waiting for a reply from the server, the other sockets all send data at maximum speed starving the incoming socket.

I could come up with a solution if I knew the available bandwidth but because it's an unknown I'm struggling to think of a good solution, does anyone have any ideas on it?

Thanks.

high_flyer
19th October 2009, 13:06
would dividing the band width to the number of outgoing sockets + 1(incoming) would help?
It would mean you send less even if not getting anything, but you will be getting at the same rate you are sending, at least in theory...

danc81
19th October 2009, 13:17
That's partly the problem, I have no way of knowing the total bandwidth to divide it, if I did then I could just keep some free for the incoming. I suppose I could measure it to see how much is available and divide it that way but it doesn't seem like a "clean" way to do it.