I'm developing a module in Python, but I guess that programming platform doesn't matter here. I'm trying to make a client connect to a server inside one thread using asynchronous programming. This means there is an event-loop that performs asynchronous jobs. And what I want to do is to - when a request comes in - create a client on localhost:Xport - and make the server asynchronously accept the connection from Xport (and perform the request and so on, blah, blah).
Since asynchronous programming is based on an event-loop and non-blocking operations (but in fact it's just a straight sequence of operations), is it possible to [1] make a client connect to a server and [2] make the server accept the connection - all in a single thread, asyhcnronously?
If it's possible, could anyone give a code snippet or some explanation?