Not picking up some messages
I am using the CSocketFile class along with CArchive. The problem that I am having is that messages are being sent to me (I checked with Ethereal about this), but I am apparently not picking up some messages. For example, I'll get the first message sent to me, but not any subsequent messages. I've seen topics on other boards about this scenario, and their solution is to do only one read, which isn't applicable in my scenario, because I want to first read in a header that has the message length, and based on that read more data. The header and data are sent as one packet, like a TCP packet. I have a onReceive function:
And here is my ReadMessage code:
void A::OnReceive(int nErrorCode) // A is derived from CSocket
// TODO: Add your specialized code here and/or call the base class
My program isn't crashing. Any idea why my messages are not being picked up?
void B::ReadMessage(CArchive &ar)
ar.Read(buf, header); // header is the length