CMessage * CMyApplication::recvMessage ( int nMaxMS) { CConnection * pConn = m_pConnectionToReader; CMessage * pMessage; /* * Receive the message subject to a time limit */ pMessage = pConn->recvMessage(nMaxMS); /* * If LLRP::CConnection::recvMessage() returns NULL then there was * an error. In that case we try to print the error details. */ if(NULL == pMessage) { const CErrorDetails * pError = pConn->getRecvError(); printf("ERROR: recvMessage failed, %s\n", pError->m_pWhatStr ? pError->m_pWhatStr : "no reason given"); if(NULL != pError->m_pRefType) { printf("ERROR: ... reference type %s\n", pError->m_pRefType->m_pName); } if(NULL != pError->m_pRefField) { printf("ERROR: ... reference field %s\n", pError->m_pRefField->m_pName); } return NULL; } /* * Print the XML text for the inbound message if * verbosity is 2 or higher. */ if(1 < m_Verbose) { printf("\n===================================\n"); printf("INFO: Message received\n"); printXMLMessage(pMessage); } return pMessage; }