Java NIO server and Python asyncore client

dieter dieter at handshake.de
Wed Feb 6 02:42:42 EST 2013


foobarometer at 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




More information about the Python-list mailing list