Yes, as per the QUdpSocket example, my UDPReceiver has the following:
// Read all available data packets
while( m_p_UDPReceiveSocket->hasPendingDatagrams() ) {
// Read the datagram
m_p_UDPReceiveSocket->readDatagram( m_p_datagram,
m_p_UDPReceiveSocket->pendingDatagramSize() );
/** Some small amount of work */
}
// Read all available data packets
while( m_p_UDPReceiveSocket->hasPendingDatagrams() ) {
// Read the datagram
m_p_UDPReceiveSocket->readDatagram( m_p_datagram,
m_p_UDPReceiveSocket->pendingDatagramSize() );
/** Some small amount of work */
}
To copy to clipboard, switch view to plain text mode
I believe the while loop is blocking the UDP socket from handling events from the OS, which is why my non-paged memory pool increases up until the size of the UDP socket buffer.
P.S. i edited the previous post. This is what I wrote in case you missed it:
There are slots connected to signals that are emitted from a different thread. I don't understand why an eventloop causes the socket to read faster, if there is already an event loop being run by the thread. The QUdpSocket is in the same thread as the slot the readyRead() signal calls. There shouldn't be any issue, right? I've placed the QUdpSocket into the main thread but then I can't read from it in the receiver thread because socketnotifiers cannot be enabled/disabled from different threads. Reading the data off the socket in the main thread and then sending them to the receiver thread is an option, but then I definitely need an event loop because it will block all GUI events.
I really appreciate your help btw. Wish I could buy you a beer 
UDPReceiver.cpp
UDPReceiver.h
Here are the files.
Bookmarks