Detecting when a user disconnects

Thanks for trying kimja, but that didn’t work.

However, Google pointed me to a thread here from over 3 years ago that had the answer (linky), seems drwr posted the solution in 2007.

My original code was right, but I wasn’t using .p() to get the actual connection. It works now :slight_smile:

    def taskCheckConnections(self, task):
        if(self.cManager.resetConnectionAvailable()):
            connectionPointer = PointerToConnection()
            self.cManager.getResetConnection(connectionPointer)
            lostConnection = connectionPointer.p()
            
            
            self.cManager.closeConnection(self.activeConnections(connectionLost))
            print "Connection has been reset: " + str(lostConnection)
            
            self.activeConnections.remove(lostConnection)
            #print "Current connections: " + str(self.activeConnections)
            for i in self.activeConnections:
                print i
        return Task.again