asyncore 100% cpu usage?

Adonis deltapigz at
Sun Aug 18 20:23:07 CEST 2002

the asyncore module seems to consume 100% cpu usage, is it the way it
suppose to be since it is nonblocking or am i flat wrong, or is it my code,
did i miss/overlook something?

any help is greatly appreciated.


-- paste --

class PYCHSCK(asyncore.dispatcher):

    def __init__(self, host, port):
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connect((host, port))

    def handle_connect(self):
        print 'Connected'
        self.send('NICK foobar\r\n')
        self.send('USER foo "HOME" "" :bar.\r\n')

    def handle_read(self):
        data = self.recv(8192)
        print data

    def handle_write(self):

    def handle_close(self):

def pychStartSock(ip, port):
    pych = PYCHSCK(ip, port)

if __name__ == '__main__':
    # not a pretty way for threading but just for
    # quick test purposes.
    threading.thread(target=pychStartSock, args=('x.x.x.x', 6667)).start()

More information about the Python-list mailing list