It has been long enough since I've looked at the co-op threading in NOX that I 
don't immediately know what the problem you're having with the file descriptors 
going away is.  You're sure you're not calling close() on them?  You could try 
setting the socket to non-blocking mode with sock.setblocking(0).

It might be possible to get asynccore to work, but I think it'd probably be 
some trouble.  Twisted, on the other hand, should more or less just work.  I 
think you can probably look at the NOX webservice stuff for a bit of an 
example, but it shouldn't be much different than any other Twisted code.

Or if you would be okay with communicating with the other process via JSON 
strings, you could use jsonmessenger.  Look in monitoring.py from the 
monitoring component for an example.

Hope that helps.

-- Murphy

On Aug 12, 2011, at 2:03 PM, chris oleke wrote:

> Hi
> 
> 
> 
> Hopefully this is still within the Nox domain. I have a python application 
> that is using sockets to send out flows that I have obtained from a 
> flow_stats_in_event to an application external of Nox. This is how I’m doing 
> it
> 
> self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> self.sock.connect(("",5000))
> self.sock.send(repr(flows))
> self.sock.close()
> 
> Unfortunately I can only send the flows once before the sockets close after 
> which I get the errors below
> 
> self.sock.send(repr(flows))
>   File "/usr/lib/python2.6/socket.py", line 167, in _dummy
>     raise error(EBADF, 'Bad file descriptor')
> error: [Errno 9] Bad file descriptor
>  
> It’s obviously as a result of trying to send information out on a socket 
> that’s been closed. I have tried to look at asyncore and see if I can have an 
> asynchronous socket but haven’t had any luck and my application’s seems to 
> lock/freeze the few times I have tried. Is there a way I can have the socket 
> remain connected so I can have flows sent constantly and also be able to 
> receive data when sent from the external application. I would like a 
> demonstration as well if it’s possible.
> 
> 
> 
> Thanks
> 
> Chris
> 
> _______________________________________________
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev

_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to