Creating socket.connect while in epoll loop

2012-09-12 Thread Miki Tebeka
Greetings, I'm trying to write a reverse TCP proxy using epoll (just for learning). I've started with the code at http://scotdoyle.com/python-epoll-howto.html and got to https://gist.github.com/3707665. However, I can't create a new connection. When reaching line 34 (backend.connect), I get

Re: Creating socket.connect while in epoll loop

2012-09-12 Thread calderone . jeanpaul
On Wednesday, September 12, 2012 12:01:58 PM UTC-4, Miki Tebeka wrote: Greetings, I'm trying to write a reverse TCP proxy using epoll (just for learning). I've started with the code at http://scotdoyle.com/python-epoll-howto.html and got to https://gist.github.com/3707665. However, I

Re: Creating socket.connect while in epoll loop

2012-09-12 Thread Miki Tebeka
You cannot synchronously set up a new TCP connection using a non-blocking socket. Instead, you begin the connection attempt and it fails with EINPROGRESS and then you use epoll to find out when the attempt completes. OK. I suggest reading the implementation of a Twisted reactor to see an