Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'debug': 0.05; 'debugging': 0.05; 'socket': 0.05; 'incompatible': 0.07; 'python': 0.09; '(it': 0.09; 'blocking': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'work"': 0.09; 'assume': 0.11; '2.7': 0.13; 'properly': 0.15; '"does': 0.16; 'asyncore': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:Java': 0.16; 'detect': 0.17; 'code.': 0.20; 'otherwise,': 0.20; 'parameters': 0.20; 'work.': 0.23; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'this?': 0.28; 'thus,': 0.29; 'writes:': 0.29; 'case,': 0.29; 'maybe': 0.29; 'becomes': 0.30; 'code': 0.31; 'gets': 0.32; 'problem.': 0.32; 'channel': 0.32; 'could': 0.32; 'goes': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'received:org': 0.36; 'but': 0.36; 'client': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'bad': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'registered': 0.38; 'mean': 0.38; 'object': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'email addr:gmail.com': 0.63; 'become': 0.65; 'received:217': 0.68; 'soon': 0.70; 'treats': 0.84; 'successful.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: Java NIO server and Python asyncore client Date: Wed, 06 Feb 2013 08:42:42 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e08d56.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:5ezFfIKmu6uf3nqIrk11ph1f01k= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360136576 news.xs4all.nl 6939 [2001:888:2000:d::a6]:55828 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38261 foobarometer@gmail.com writes: > Can someone help answer this? > http://stackoverflow.com/questions/14698020/java-nio-server-and-python-asyncore-client > > Blocking python client works, asyncore doesn't work. I fear you must tell us which Python version you are using. Your call to "dispatcher.create_socket" is incompatible with the code in Python 2.7 (it lacks parameters "family" and "type"). Otherwise, I could not detect a problem in your code. I assume that "does not work" does not mean "I get an exception" but means "I do not get anything". You might need some debugging to detect the problem. Check "dispatcher.socket_map" after you have set up your connector. It should contain your connector object and this should be both "readable()" and "writable()". If this is the case, I would debug "asyncore.loop": "asyncore.dispatcher" treats the socket as "connected" as soon as it becomes either "readable" or "writable". Both should happen after "connect" is successful. Thus, I would look what goes wrong: * the socket does not become readable/writable this would proabably mean that the socket never gets connected, maybe because of bad parameters to "create_socket". * the channel is not properly registered * bad internal state