1

I want to implement the following but I'm not sure where to start / what to Google. I'd appreciate some direction since I've never written any program that requires network connectivity and am pretty lost:

I've got 3 Raspberry Pis sitting around. I want 2 of them to be able to chat while the 3rd routes the messages (acts as a server between them).

The general flow of events should be something like this:

  1. Server starts running on Pi #1
  2. Pi #2 starts running and connects to the server (who's IP will be static I guess) with a name he chooses. Pi #3 does the same as #2.
  3. Pi #3 can then, knowing the name of Pi #2, send a message to Pi #2 using: : .

This is the general outline of what I want to achieve.

I'm not sure what the server that runs on Pi #1 should be (I've heard of webserver frameworks like Flask but I don't have enough knowledge to determine if they fit my needs).

I'm also not sure on what I should be using for the client side (Pi #2,3). I could probably use sockets but I assume there is a better / easier way.

matanc1
  • 6,525
  • 6
  • 37
  • 57

1 Answers1

2

If you are on a private network, XML-RPC might be a good choice, because

  • It's built into Python, see this example
  • You can call remote functions almost as if they where local

Drawbacks:

  • Little network security
  • When sending raw data, it needs to be encoded (since to is a text protocol)

To check if your remote server is running, you can use sockets as in this example.

Dietrich
  • 5,241
  • 3
  • 24
  • 36
  • Actually I was hoping I could connect to the server from afar. – matanc1 Aug 08 '14 at 21:22
  • You can go on a public network, but you should be aware of security issues. It is doable to make it secure, it just makes it a bit more complicated. E.g, checkout http://stackoverflow.com/questions/2956778/how-do-i-implement-secure-authentication-using-xml-rpc-in-python – Dietrich Aug 08 '14 at 21:49