Hello everyone,
I am working on Linux PC and want to make a program to get data from RaspberryPi(another Linux machine).
Both machines are connected together by CAT5 cable directly without any Switch or Hub.
Linux PC hostname is mike and IP is 192.168.93.12
Raspberry hostname is pi and IP is 192.168.93.13

can you plz guide me to make simple program for this task.
Thank You

An extremely simple way to send data from one computer to another is to use an xml_rpc server. Try to run the example code in the python documentation for the xml-rpc protocol. An example server on one machine, the example client on the other machine.

u mean this program

import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer

def is_even(n):
    return n%2 == 0

server = SimpleXMLRPCServer(("localhost", 8000))
print "Listening on port 8000..."
server.register_function(is_even, "is_even")
server.serve_forever()

Yes, this is the server program. You must run the client program on the other machine. Of course, the client program must use the server's IP address.

I just want to receive a RaspberryPi video file from this location '/home/python/video.h264'
I already set a static IP for RaspberryPi device 192.168.93.12
Before that I was using below command to get my required data
So plz if you can just guide me that how do I use below in my Python program.

Thanak You

rsync -rav pi@192.168.2.27:python ~/

Oh well if you only want to run a command from python you can do

import subprocess
subprocess.call('rsync -rav pi@192.168.2.27:python ~/', shell=True)

Thanks for suggeation,
after typing this command, system ask for the password

import subprocess
subprocess.call('rsync -rav pi@192.168.2.27:python ~/', shell=True)

is that possible if I can put remote machine in the programming in advance.
Thank you

It is not a python issue, it is an rsync issue. Solve the problem outside of python, then use the solution in python. There are ways to use rsync without being prompted for password, but I don't know rsync well enough. You should google for it, and perhaps ask in the linux forum.

Thanks for your suggestion.
I solved 'rsync' issue through Linux recommeneded procedure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.