5 Respuestas
+ 3
You need to open the file, then take the length of the file and send it to the receiver. Open the file in binary mode (rb).
Then, you read the file by block (using seek and read function) and you send the whole file block by block.
The receiver knows the file's length, so it knows when it's the file end.
+ 3
Thank you very much
This was helpful
But what about a case in which the files are images
+ 2
Hi Owen, you can read/write image files as easily as you can read/write text files in python. Do the same thing with image files as you did with text files.
+ 1
That isn't a problem because you open the file in binary mode, and all datas sent must be in binary.
0
1 - make an http.server by "python -m http.server"
2 - upload the images there
3 - get your private ip
4 - open that ip on the other computer
5 - download the images