Issue1237

classification
Title: Asnycore does not seem to work in Jython 2.5 (b0 or b1)
Type: Severity: normal
Components: Library Versions: 2.5b1, 2.5b0
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, billiejoex, mlevalle
Priority: Keywords:

Created on 2009-01-13.11:41:32 by mlevalle, last changed 2009-02-04.15:53:05 by amak.

Messages
msg4041 (view) Author: Michael A. LeValle (mlevalle) Date: 2009-01-13.11:41:31
The following example asyncore http client provided in the Python
Library Reference of Python2.5.4 documentation works in Python 2.5 but
not in Jython. Python 2.5 returns the text of the html page. Jython 2.5
returns nothing.

import asyncore, socket

class http_client(asyncore.dispatcher):

    def __init__(self, host, path):
        asyncore.dispatcher.__init__(self)
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connect( (host, 80) )
        self.buffer = 'GET %s HTTP/1.0\r\n\r\n' % path

    def handle_connect(self):
        pass

    def handle_close(self):
        self.close()

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

    def writable(self):
        return (len(self.buffer) > 0)

    def handle_write(self):
        sent = self.send(self.buffer)
        self.buffer = self.buffer[sent:]

c = http_client('www.python.org', '/')

asyncore.loop()
msg4130 (view) Author: Alan Kennedy (amak) Date: 2009-02-04.15:53:04
Indeed, the existing asyncore was completely broken, and could not
correctly run this very straightforward usage example; thanks for taking
the time to submit it.

I have checked in a new version of asyncore, ported from cpython 2.5 to
jython 2.5, at r6012 and r6013.

Although this may not have eliminated all of the outstanding asyncore
bugs, the jython 2.5 asyncore now runs this example identically to cpython.

Until there is a new release of jython 2.5, you can get the latest
asyncore from SVN.

https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython/Lib/asyncore.py
History
Date User Action Args
2009-02-04 15:53:05amaksetstatus: open -> closed
resolution: fixed
messages: + msg4130
2009-01-29 21:07:46amaksetassignee: amak
nosy: + amak
2009-01-14 15:23:23billiejoexsetnosy: + billiejoex
2009-01-13 11:41:32mlevallecreate