简体   繁体   中英

how to run a program in another computer using python network programming?

i am so new in python programming so i apologize if my question is not appropriate. Supose there is a network of several computers, i want to write a program that will be running on a centeral system (one of those computers) with python. I need this program to execute a GUI_based program in every other computers in network and collect the result data in centeral system (the GUI_based program will give some result file). i know there is a way to transfer file or data between server and clients but my question is, is there any way or methode in python programming (i mean socket in network programming with python) that can call or execute a program in client system? thanks in advance.

You can use Python's paramiko library but that require access to your system ie SSH for linux.

The paramiko package also offers the option for an ssh server, so this might be a solution for your windows machine

It could be something like

client_machine = SSHClient()
client_machine.load_system_host_keys()
client_machine.connect('linuxip', username='your_user', password='very_secret')
stdin, stdout, stderr = client_machine.exec_command('python /home/your_user/your/path/to/scripty.py')

Note: its not secure to store your password. Use public and private key for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM