I would like to send images with socketserver of python 3 and I have a problem of encoding. Do I need to send it in bytes or in text? And do I need to open my image with the 'b' option and to transform it in a particular format?
With previous version of python I could do :
image = open('my_image.jpg', 'rb')
image_data = image.read()
image.close()
socketData = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socketData.connect((ADDRESS,PORT))
socketData.sendall(image_data)
But with python 3, it doesn't work anymore. There are encoding and codecs problems and I don't really understand the using of encode(), decode() or str().
Do you have any idea how I can implement it?
Thanks