Python Intercomputer Communication

This whole topic comes out of my depth, so forgive my inaccurate question, but I have two computers connected to the same local network.

I want to be able to bind one line between them by running a python script on the first (host) where the line will occur, and the second on the client computer to extract the line.

What is the most effective way for an inexperienced programmer like me to do this?

+3
source share
3 answers

First, let's get the item straight. Typically, the part that initiates the connection is the client, the parts that are waiting for the connection are the server, which will then receive data from the client and generate a response. From your question, β€œhost” is the client, and β€œclient” seems to be the server.

Then you need to decide how to transfer the data. You can use direct sockets, in which case you can use SocketServer, or you can rely on an existing protocol, such as HTTP or XML-RPC, in which case you will find ready-to-use library packages with a lot of examples (for example, xmlrpcliband SimpleXMLRPCServer)

+4
source

There are about a million ways.

, SocketServer, , , , .

: http://docs.python.org/library/socketserver.html#examples

+3

File system file system and polling every minute. No kidding. Of course, this depends on the requirements for your applications and what the lag is acceptable, but in practice the use of shared files is quite common.

-2
source

Source: https://habr.com/ru/post/1738886/


All Articles