PDA

View Full Version : QudpSocket: Speed Issue



jepessen
25th March 2011, 15:54
Hi.
I'm trying to create a connection between two application using QUdpSocket.

I send many udp packet consequently, for example


uiDatawritten = m_pxUdpSocket->writeDatagram(xByteArray.data(), xByteArray.size(), *m_pxHostAddress, UDPPORT);
uiDatawritten2 = m_pxUdpSocket->writeDatagram(xByteArray2.data(), xByteArray2.size(), *m_pxHostAddress, UDPPORT);

But, when I do it, the second application receives only the last packet, and the first is discarded.

I'd like to known if it's a known issue, and how I can resolve it, also considering that I can't use TCP and I need to send packets as fast as possible.
Any help is appreciated.

wysota
25th March 2011, 16:07
UDP doesn't guarantee to deliver all datagrams and also doesn't guarantee the order in which they are received.

jepessen
25th March 2011, 19:58
Thanks for your reply. I've tried to use TCP, but I can't change the other application that's not mine...
There's some test to see what's the minimum time interval that must pass between one packet and the following, to have an high probability that both of them can be received?

wysota
25th March 2011, 20:09
There is no such test. Everything depends on the network segments those datagrams are travelling through. Any UDP datagram can be discarded by any router without any explanation. Check if your communication works properly on localhost and just design your protocol in a way that can cope with datagram loss.

jepessen
25th March 2011, 20:37
Ok I'll find a solution. Thanks for your suggestions.