I just coded a little client/server program. I used the socket
module of python3
for this.
And i wanted to know how to not only send strings but other datatypes besides the basic datatypes. So for example, images as jpgs
or whatever or how to send mp4
or avis
something like that so basically visual datatypes that are used in the daily life.
My first thought was to code it exactly the same as with strings:
socket_name.send(bytes('string'))
but then i would need a function to convert the datatype into bytes and back on the server and I couldn't find one that provides this.
So I searched for other functions and found sendfile
and makefile
. I tried them out but I couldn't find how to use them properly and it didn't work.
So my question is simply how to send visual data via a socket
in python3
.