BoringGuy
Posts: 2
Joined: Thu Feb 18, 2016 2:03 pm

Pi to Pi Communication

Thu Feb 18, 2016 3:03 pm

I have 3 Pi's on which two have programs running on them that have two ArrayLists that are printed to an Excel sheet, but are also able to print to a text file. On the third, I wish to be hosting a web server on the LAN that will take the data from the two other Pi's and put them on one page.

I plan to have the 3rd Pi running Apache2, which I have used before. I thought about having a java program that will take the data and rewrite the HTML page Apache uses on the Pi, but I am open to any options.

I have looked into this by searching things like "Send file from Raspberry pi to raspberry pi" and similar, but only found from Pi to/from computers.

pksato
Posts: 295
Joined: Fri Aug 03, 2012 5:25 pm
Location: Brazil

Re: Pi to Pi Communication

Thu Feb 18, 2016 5:02 pm

Hi
RPi is a computer. :)
A small one, but is a computer.
To send a file, you can use scp or sftp, with pre shared key.
Or via http post, using curl (or other) on sender side, and a cgi application on receiver (server).

cgi or commom gateway interface can be write in java, php, node.js, python, etc.
some languages have modular version of cgi. like php.

BoringGuy
Posts: 2
Joined: Thu Feb 18, 2016 2:03 pm

Re: Pi to Pi Communication

Thu Feb 18, 2016 6:17 pm

Would I be able to send the ArrayList itself or a file? I could output the ArrayLists to two files, send them and read them into ArrayLists on the other Pi.

ejolson
Posts: 6328
Joined: Tue Mar 18, 2014 11:47 am

Re: Pi to Pi Communication

Thu Feb 18, 2016 9:50 pm

BoringGuy wrote:I have 3 Pi's on which two have programs running on them that have two ArrayLists that are printed to an Excel sheet, but are also able to print to a text file. On the third, I wish to be hosting a web server on the LAN that will take the data from the two other Pi's and put them on one page.

I plan to have the 3rd Pi running Apache2, which I have used before. I thought about having a java program that will take the data and rewrite the HTML page Apache uses on the Pi, but I am open to any options.

I have looked into this by searching things like "Send file from Raspberry pi to raspberry pi" and similar, but only found from Pi to/from computers.
The easiest solution may be to network mount the file system of the web server Pi onto the other Pis. Then the other Pis can write directly to the html directories served by the web server. Try searching on NFS and "man nfs" for more information.

Return to “General discussion”