Actually, no.  The version I posted has Python support for the plain messenger 
too, not just the JSON messenger.  But it sounds like you're satisfied with 
using the JSON messenger.

See the channel.receive() method in nox/coreapps/messenger/messenger.py.  But 
really this is just simple socket IO.

Hope that helps.

-- Murphy

On Jan 9, 2012, at 11:00 PM, Harshil Anil Kumar Shah wrote:

> Hi Murphy,
> Thanks for the reply.
> I am using the Zaku beta version. I guess it is the same library that you 
> sent.
> But one question I have is, I got some working example of send() function 
> from nox-send-cmd.py but for recv() function, I can’t find example. How can I 
> use recv() functionof messenger.py??
>  
> Thanks,
> Harshil
>  
>  
> From: Murphy McCauley [mailto:jam...@nau.edu] 
> Sent: Wednesday, December 21, 2011 4:47 PM
> To: Harshil Anil Kumar Shah
> Cc: Kyriakos Zarifis; nox-dev@noxrepo.org
> Subject: Re: [nox-dev] Nox messenger example for external c++ and nox python
>  
> No, the plain messenger is not exposed to Python.  Kyriakos and I did enough 
> of the JSON messenger to get monitoring working, but never did the normal 
> messenger.  The messenger.py should really be named messenger_client.py, and 
> maybe shouldn't even be in that directory -- it's a library for writing 
> messenger clients, and not a NOX component.
>  
> I've taken a quick stab at exposing the plain messenger to Python.  You can 
> grab my current messenger directory from:
> http://www.noxathome.org/x/Murphy/messenger/messenger.zip
>  
> Using it is very much like using jsonmessenger (as monitoring does).  
> Something like:
>  
> 1) In your component's install function:
> from nox.coreapps.messenger.pymsgevent import Msg_event
> self.register_handler(Msg_event.static_get_name(), myHandler)
>  
> 2) Implement a handler:
> def myHandler (e):
>   print e.type, e.body
>  
> 3) Include pymessenger on the commandline or as a dependency
>  
> Messages for messenger are prefixed with a three byte header:
> 2 Byte Network Order Unsigned Integer:
>   Message length (including header)
> 1 Byte:
>   Message type (can be anything, but I think 0-9 are reserved -- see 
> messenger.hh)
>  
>  
> Hope that's useful.
>  
> -- Murphy
>  
> On Dec 21, 2011, at 2:46 AM, Harshil Anil Kumar Shah wrote:
> 
> 
> Thanks Murphy.
> I guess 2nd option is the better to go with.
> Can I use boost.python for that?
> And I guess plain messenger is exposed to python. There are messenger.py  and 
> messenger.cpp/hh files corresponding to plain messenger.
>  
> -Harshil
>  
> From: Murphy McCauley [mailto:jam...@nau.edu] 
> Sent: Wednesday, December 21, 2011 2:33 PM
> To: Harshil Anil Kumar Shah
> Cc: Kyriakos Zarifis; nox-dev@noxrepo.org
> Subject: Re: [nox-dev] Nox messenger example for external c++ and nox python
>  
> So NOX's messenger is a fairly generic method for communicating with external 
> applications over a socket.  Built on top of this is jsonmessenger which 
> communicates JSON messages over a socket.
>  
> If you specifically want to use protobufs (and not JSON messages), then you'd 
> want to use the plain messenger.  However, the plain messenger is not exposed 
> to Python -- only jsonmessenger is.
>  
> So I think your options are:
> 1) Use JSON messages instead of protobufs, and just use jsonmessenger
> 2) Expose messenger to Python, and then use this to send/receive protobufs
> 3) Use protobufs and roll your own method for communicating with your 
> external application (probably using Twisted)
>  
> -- Murphy
>  
> On Dec 20, 2011, at 11:02 PM, Harshil Anil Kumar Shah wrote:
> 
> 
> 
> Hi Murphy.
> Yes, I have external C++ module which I want to communicate with Nox python 
> module using protobuf. I am using libjson library at C++ module.
>  
> -Harshil.
>  
> From: Murphy McCauley [mailto:jam...@nau.edu] 
> Sent: Wednesday, December 21, 2011 1:38 AM
> To: Harshil Anil Kumar Shah
> Cc: Kyriakos Zarifis; nox-dev@noxrepo.org
> Subject: Re: [nox-dev] Nox messenger example for external c++ and nox python
>  
> Do you mean that you have some external program (written in C++) that you 
> want to communicate with a NOX component (written in Python)?
>  
> jsonmessenger works by sending and receiving JSON (http://json.org) messages. 
>  So on the NOX side, you use jsonmessenger.  In the external program, you can 
> use any of several libraries for doing JSON encoding/decoding.
>  
> -- Murphy
>  
> On Dec 20, 2011, at 1:09 AM, Harshil Anil Kumar Shah wrote:
> 
> 
> 
> 
> Hi,
> In my case where external module is C++ then can I use “pyobject” to interact 
> with python module?
>  
> From: Harshil Anil Kumar Shah 
> Sent: Monday, December 19, 2011 3:32 PM
> To: 'Kyriakos Zarifis'
> Cc: nox-dev@noxrepo.org
> Subject: RE: [nox-dev] Nox messenger example for external c++ and nox python
>  
> Thanks Zarifis…
>  
> I looked at GUI example. It seems very useful. But in my case, client is 
> external C++ module. So in that case do I have to use use messenger.cpp??
>  
> -Harshil.
>  
> From: nox-dev-boun...@noxrepo.org [mailto:nox-dev-boun...@noxrepo.org] On 
> Behalf Of Kyriakos Zarifis
> Sent: Monday, December 19, 2011 1:38 PM
> To: Harshil Anil Kumar Shah
> Cc: nox-dev@noxrepo.org
> Subject: Re: [nox-dev] Nox messenger example for external c++ and nox python
>  
> Hi Harshil,
>  
> it might not be the simplest example, but the GUI communicates with NOX using 
> the messenger, so taking a look at that code might be a good starting point.
>  
> Specifically, the file communication.py is responsible on the GUI side. 
> Similarly on the NOX side, the code that uses the messenger to send messages 
> to the GUI is inside the respective component that talks to the GUI. The 
> component "monitoring" is one of them.
> 
> Some of this is documented on the wiki here:
> http://noxrepo.org/noxwiki/index.php/NOX_GUI#Connecting_a_subview_to_a_NOX_component
> 
> On Sun, Dec 18, 2011 at 10:41 PM, Harshil Anil Kumar Shah 
> <harshil_s...@infosys.com> wrote:
> Hi,
>  
> I want to exchange messages between external C++ module and python module  in 
> Nox using protobuf messages. I browsed through couple of posts, I figured out 
> I can  use coreapps/messenger. Can I get some working example how messenger 
> code can be used for message exchange between external c++ and nox python 
> module.
>  
> Regards,
> Harshil Shah,
> Convergence Lab, Infosys Labs
> Infosys | Bangalore
> Mob # : +91 97428 87966.
>  
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
> for the use of the addressee(s). If you are not the intended recipient, 
> please 
> notify the sender by e-mail and delete the original message. Further, you are 
> not 
> to copy, disclose, or distribute this e-mail or its contents to any other 
> person and 
> any such actions are unlawful. This e-mail may contain viruses. Infosys has 
> taken 
> every reasonable precaution to minimize this risk, but is not liable for any 
> damage 
> you may sustain as a result of any virus in this e-mail. You should carry out 
> your 
> own virus checks before opening the e-mail or attachment. Infosys reserves 
> the 
> right to monitor and review the content of all messages sent to or from this 
> e-mail 
> address. Messages sent to or from this e-mail address may be stored on the 
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
> 
> _______________________________________________
> 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
>  
>  
>  

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

Reply via email to