Message passing between Python scripts


32 posts   Page 2 of 2   1, 2
by joshmosh » Mon Apr 08, 2013 5:30 am
@mefarmer:
Thank you for all the effort you are putting in :-)

I will give it a try later the day and report back.

Thank you and all the best
Josh
Posts: 62
Joined: Fri Aug 03, 2012 12:04 pm
by joshmosh » Mon Apr 08, 2013 2:14 pm
@mefarmer:
Your fix did not work for me :-(
Nothing on the receiving side, although I responded with an empty message.

What bothers me are the IP numbers. Local host is fine, but what about the mcast address ? I have used your udp.py unchanged and also made my calls to producer and consumer without any parameters, because I have absolutely no idea what the mcast addresses in my local network could be - never used multicast before. Could it be possible that the address in your code (224.168.9.2) ends up in Nirvana in my network ? Or is this mcast address something generic, such as 127.0.0.1 ?

Please don't put too much effort into it - I can survive with my current solution to communicate between the two Raspis via a file on my NAS.

Thank you
Josh
Posts: 62
Joined: Fri Aug 03, 2012 12:04 pm
by mefarmer » Mon Apr 08, 2013 6:35 pm
The IP address is just a random one chosen from the range of multicast IP's you can modify it.
I just looked back at the code I posted and it slightly different than the one I was using last night when I got it working from Raspberry Pi to Windows. I have only one RPi so I can't test if it will work for you but when I get home I will post the modified code. I am going to guess it won't work but who knows.
Posts: 36
Joined: Wed Mar 13, 2013 10:53 pm
by joshmosh » Mon Apr 08, 2013 6:55 pm
mefarmer wrote:The IP address is just a random one chosen from the range of multicast IP's you can modify it.

The question is: do I need to modify it or is any multicast IP ok ?
mefarmer wrote:I just looked back at the code I posted and it slightly different than the one I was using last night when I got it working from Raspberry Pi to Windows. I have only one RPi so I can't test if it will work for you but when I get home I will post the modified code. I am going to guess it won't work but who knows.


Please don't invest too much time - I can survive with my hammer-and-anvil solution ;-)
Anyway, thank you for your time and effort
Josh
Posts: 62
Joined: Fri Aug 03, 2012 12:04 pm
by mefarmer » Mon Apr 08, 2013 7:24 pm
I could be wrong but I think any in the multicast range will work just don't use 224.0.0.1
Don't feel bad for me spending time on this i'm charging you by the hour for my incompetence ;)
Posts: 36
Joined: Wed Mar 13, 2013 10:53 pm
by MarkStokes » Wed Apr 10, 2013 11:51 am
Thanks everyone for the input.

Based on my long term goals, I have decided that the best solution for me is a centralised MongoDB database on my network (not on the Pi) where all data can be passed between.

The amount of throughput that I am expecting means using text files doesn't scale for me and I don't want a centralised "server" to manage sockets requests. Whilst broadcast could work, I think that in my scenario sensors dumping sensor logs to a MongoDB and all the other AI data I want to build in means that services can pick and choose from the centralised DB.

Thanks for all the comments though, it has given me a lot of additional knowledge and options.

Mark
User avatar
Posts: 5
Joined: Thu Apr 04, 2013 7:19 am
Location: Manchester, UK
by leinad » Sat May 11, 2013 8:35 pm
Hi,

I've just read the first post and then used the browser's find utility to check if the following was mentioned:

It's trivial to get AutobahnPython working on the RPi. It is based on the Websocket protocol, and adds another one on top of it: WAMP

It has no other dependencies than the Twisted framework.

This allows you to perform RPC calls between scripts, and also let browsers join the party. It also supports PubSub, so it's quite a flexible solution.

Kind regards,
Daniel
Posts: 4
Joined: Fri Jun 08, 2012 2:42 pm