I have a problem with something, and I assume this is code.
The app is used to ping some custom network devices to check if they are alive. He pings them every 20 seconds with a special UDP packet and waits for a response. If they cannot respond to 3 consecutive pings, the application sends a warning message to the staff.
The application works around the clock and for a random number of times a day (mainly 2-5), the application cannot receive UDP packets for the exact time of 10 minutes, after which everything returns to its normal state. During these 10 minutes, only 1 device seems to be responding, others seem to be dead. That I could deduce from magazines.
I used wirehark to sniff the packets, and I checked that the ping packets both go AND inside, so the network part seems to work fine, right down to the OS. WinXPPro runs on computers, and some do not have a firewall configured. I have this problem on different computers, different Windows installations and different networks.
I really don't understand what could be the problem here.
I am attaching the corresponding piece of code that makes the whole network. This runs in a separate thread from the rest of the application.
I thank you for what you could imagine.
def monitor(self): checkTimer = time() while self.running: read, write, error = select.select([self.commSocket],[self.commSocket],[],0) if self.commSocket in read: try: data, addr = self.commSocket.recvfrom(1024) self.processInput(data, addr) except: pass if time() - checkTimer > 20: # every 20 seconds checkTimer = time() if self.commSocket in write: for rtc in self.rtcList: try: addr = (rtc, 7) # port 7 is the echo port self.commSocket.sendto('ping',addr) if not self.rtcCheckins[rtc][0]: # if last check was a failure self.rtcCheckins[rtc][1] += 1 # incr failure count self.rtcCheckins[rtc][0] = False # setting last check to failure except: pass for rtc in self.rtcList: if self.rtcCheckins[rtc][1] > 2: # didn't answer for a whole minute self.rtcCheckins[rtc][1] = 0 self.sendError(rtc)