HTTP over Asynchronous AF_UNIX Socket in python

Marko Rauhamaa marko at pacujo.net
Mon Jan 26 15:12:12 CET 2015


Norah Jones <nh.jones01 at gmail.com>:

> But this cannot work since normal socket will not work and thus i
> thought of `asyncore` module in python. To use asyncore module again i
> will have to subclass asyncore.dispatcher. This class also contains
> connect() method.
>
> Another problem is I don't know how asyncore module works and thus not
> able to find a way to mix the work of 1) listening forever, accept the
> connection, store id and the sock_fd.
> 2) accept data from the process' agent sister process, retrieve the
> sock_fd by matching the id in the dictionary and send it through the
> AF_UNIX socket.

Asyncore was a nice idea, but you shouldn't build anything on top of it.
The newest Python versions have moved to a scheme called asyncio. Its
programming model is a bit unconventional and hasn't won me over yet.

Personally, I have found select.epoll(EPOLLET) plus a timer
implementation enough of a framework for all of my async needs.

Then comes HTTP support. The stdlib networking facilities are great for
quick scripting, but not really compatible with the asynchronous
paradigm. I have coded my protocols by hand myself.


Marko



More information about the Python-list mailing list