That's a good question, and I don't know of a clear winner for all cases or 
anything.  Here's some pro/con:

1: select() loop
+ It's mostly just plain old Python.
- Have to worry about multithreading type issues.  If asynchronous 
communication between this IO loop thread and cooperative Tasks (like OpenFlow) 
fits your design (you're okay with queuing up requests and responses, for 
example), this may not be too hard.  There should be at least a couple examples 
in POX of different ways to do this.

2: yield Select() loop
+ Fits into POX coop model
+ Can use similar code to a plain old select() loop with blocking IO
- Not super well documented / exemplified

3: IOWorker
+ Fits into POX coop model
+ Nice abstraction (hopefully)
- Not super well documented / exemplified
- It's another layer on top of #2, so in some sense may just be making things 
LESS clear (this is mostly a concern because of the fact that it's not super 
well documented and there have only been a handful of users)

All that said, I used IOWorker for a reasonably complex project last year.  It 
involved several IOWorker subclasses and having 10s of client and server 
sockets both of the plain and SSL variety going simultaneously.  IOWorker got 
an upgrade as part of this, and I think it worked out pretty well.

-- Murphy

On Apr 11, 2013, at 6:00 PM, kk yap wrote:

> Which would you recommend?
> 
> Btw, I do want the socket to be capable of supporting both client and
> server sockets.
> 
> Regards
> KK
> 
> On 11 April 2013 17:58, Murphy McCauley <[email protected]> wrote:
>> There have only been a few users of the modern (betta) version, AFAIK.  But 
>> the messenger component is specifically JSON-oriented.  If you want to do 
>> binary messages, you can:
>> 
>> 1) Write a plain old socket server thing that runs on another thread (i.e. a 
>> select() loop) and interacts with the coop Tasks.  The web stuff works this 
>> way.
>> 2) Write a recoco-friendly cooperative socket server thing that runs in its 
>> own cooperative Task (i.e. a yield Select() loop, like of_01)
>> 3) Use the lib.io_worker IOWorker abstraction (basically a wrapper around #2)
>> 
>> -- Murphy
>> 
>> On Apr 11, 2013, at 5:46 PM, kk yap wrote:
>> 
>>> Hi,
>>> 
>>> Has anyone actually used messenger.TCPTransport?  My goal is to handle
>>> TCP connections with binary messages.  So, I am hoping that I can
>>> reuse this component.
>>> 
>>> Any advice is appreciated.
>>> 
>>> Regards
>>> KK
>> 

Reply via email to