Hi,
is there a method to slow the loop without blocking the window.
here is my code:
while(m_pSocketUDP->hasPendingDatagrams())
{
T_Buffer *pBuffer=NULL;
Sleep(1);///////// i'm using Sleep() but it block the window
pBuffer = m_pBufferCirculaire->GetNextBuffer();
if(m_pSocketUDP)
m_pSocketUDP->readDatagram((char*)pBuffer->cData,MAX_SIZE_PACKET,&QHostAddress(m_pConnectionRTAS->szAddress),&quiPort);
sReveivevalidate = *((unsigned short*) &pBuffer->cData);
sSizePacketReceive = *((unsigned short*) &pBuffer->cData[POSITION_SIZE_PACKET]);
sDeadValue = *((unsigned short*) &pBuffer->cData[sSizePacketReceive - SIZE_END_PACKET]);
if(sReveivevalidate == KEY_SECURITY_RTAS && sDeadValue == END_PACKET)
pBuffer->cStatut = VALID_MSG;
if(m_pBufferCirculaire)
m_pBufferCirculaire->EnWriteOnNextBuffer();
}
while(m_pSocketUDP->hasPendingDatagrams())
{
T_Buffer *pBuffer=NULL;
Sleep(1);///////// i'm using Sleep() but it block the window
pBuffer = m_pBufferCirculaire->GetNextBuffer();
if(m_pSocketUDP)
m_pSocketUDP->readDatagram((char*)pBuffer->cData,MAX_SIZE_PACKET,&QHostAddress(m_pConnectionRTAS->szAddress),&quiPort);
sReveivevalidate = *((unsigned short*) &pBuffer->cData);
sSizePacketReceive = *((unsigned short*) &pBuffer->cData[POSITION_SIZE_PACKET]);
sDeadValue = *((unsigned short*) &pBuffer->cData[sSizePacketReceive - SIZE_END_PACKET]);
if(sReveivevalidate == KEY_SECURITY_RTAS && sDeadValue == END_PACKET)
pBuffer->cStatut = VALID_MSG;
if(m_pBufferCirculaire)
m_pBufferCirculaire->EnWriteOnNextBuffer();
}
To copy to clipboard, switch view to plain text mode
thank you in advance
Bookmarks