I judge server to the client a heartbeat if 3 minutes received heart can take the initiative to disconnect the client socket, I in the heart of the handler to add the timeGetTime () and then to get to the DWORD time endures and then create a thread in the map function with a while loop and Sleep (180000) to 3 minutes into the detection function is a function is for current timeGetTime () value and the map of this device to upload heartbeat time values do subtraction if DWORD1 - DWORD2 & gt; 180000 3 minutes haven't received the heartbeat is shutdown (& amp; Fd) but after actual operation found doing DWORD1 - DWORD2 & gt; 180000 when the size of this comparison is always smaller than 180 million still entered the if statement that is why make for 2 days don't know where the problem of CodePudding user response:
A multithreaded expert help think about what problem
CodePudding user response:
180000 not is smaller than 180 million?
CodePudding user response:
With more accurate time control, I also don't know is your DWORD1 zha to, more do not know DWORD2 zha to ground
CodePudding user response:
DWORD DWORD UNSIGN is LONG, you convert into LONG LONG the signed data types, subtraction operation to do again,,,,