Excellent, glad you managed a workable solution.
We're currently working on a nox wiki which contains a faq and other
pointers. This might be a suitable addition.
The link is: http://noxrepo.org/noxwiki/. Feel free to add if you see fit.
.martin
Hi Martin,
after playing around with twisted deferreds and callbacks/errbacks
etc., I finally handled my blocking call - used for continuously
reading kernel generated packets from a TAP device, and sending these
through the OF controller - using twisted's reader functionality (as
suggested by Kyle - thanks a lot!). In case someone else is interested
in doing something similar, here is some code which got me started:
On 15.04.2010, at 17:58, Kyle Forster wrote:
...
class MyFileReader():
def __init__(self):
#open the file
def doRead(self):
#read from the file, sending an event back in to nox with
#inst.post(pyevent(MY_FILE_READER_EVENT, e))
...
#(dumb impementations of doWrite, fileno and connectionLost)
from twisted.internet import reactor
...
reactor.addReader(MyFileReader())
...
The file reader runs in the background and fires an event whenever new
data is available on the file descriptor - very nice!
I also came across this blog entry, which has some useful infos about
using IReadDescriptor:
http://krondo.com/blog/?p=1445
Best regards,
Zdravko
On 15.04.2010, at 06:26, Martin Casado wrote:
I've not tried using Python threads within Nox. It very well could
be broken. You can grep around src/nox/coreapps/pyrt/ to see the
reactor implementation within Nox.
I would suggest using Twisted event harness and deferred's rather
than Python threads.
.martin
Hello *,
I recently started working on a project using NOX. I'm wondering how
(if at all) I can use python threads in my controller (I want to use
these
to handle a blocking function call). I came across this post, dealing
with a similar problem:
http://www.mail-archive.com/nox-dev@noxrepo.org/msg00430.html
where it is hinted, that using the twisted framework would be the right
approach. So far I've tried (unsuccessfully) using the callInThread and
deferToThread functions from twisted. Are these functions
implemented in
the NOX reactor? Also, is my assumption that reactor.run() is executed
automatically by NOX correct?
I would be very thankful for any pointers!
Best regards,
Zdravko
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org