Hello, all professionals
I aim to create three scripts (one in Host, the other two in 2 different Guests) realizing server vs multi-clients communications.
There is a file in my Host system, what I propose to do is transmitting lines in that file to different Guests.
Following is the raw code I wrote for Host:
import socket, fileinput
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((' ', 2000))
s.listen(2)
conn, addr = s.accept()
for data in fileinput.input("/path/data.txt"):
conn.send(data)
conn.close()
Let's say, I created 6 lines in my data.txt with each line is only a number calculated from 1 to 6.
How to implement:
Transmitting first 3 digits to the first Guest and the other 3 digits to the second Guest?
Thank you for all your cordially helps.
I am grateful for your considerations.