I used Ethereal... but I was not too lucky :( All the packets server and client exchange are ok. It seems the client simply stop working, but Ethereal says all the packets arrive to client (I send a NOP message once a minute and when client goes idle it never write it has received them in the log).
So I'm pretty sure to say there's something wrong in the client... even if its threads are no deadlocking. I know my log could be not detailed enough; now it contains the following information:
- if a thread is waiting for an event
- if an event/semaphore is setted/released
-
how many bytes are sent/received from which socket (adding getpeername() result, as hplus0603 suggested), and what is returned by each function (Ethereal says me
what is sent/received each time)
Each time I write something in the log I add at which time it happens (I syncronized my computers with an external server, but anyway Ethereal gives me the right times).
Quote:
Look for things like re-using file descriptors, memory overwrites, half-formed packets, if() branches not taken, ...
Memory overwrites are checked by a memory manager I added since the beginning... I think the check is done when mem is freed, so maybe it can be the problem (since it could be random as the moment when client goes idle).
I'd exclude half-formed packets, since Ethereal assures me that all packets are ok (sent/acknowledged/checksum ok, etc).
I will profile my client program to see if() branches not taken, I will check (using a tool I wrote some time ago) if I re-use file descriptors.
I think memory overwrites could be the most likely problem: it idles the client always with no apparent reason. Maybe the memory block that hold the socket is overwritten by someone; in this case, server can send data to client, but client is no more able to receive them. Don't you agree with me? Unlucky I cannot check things like socket window handle, because they are private members of CSocket/CAsyncSocket classes, I will try using CObject::AssertValid() method each time I use it (and each time I use all the objects of CObject derived classes).
I thank you very much for your help and suggestions [smile]. Reply me if you have other ideas... meanwhile I keep on debugging [depressed]
Again, thank you very much!