You do realize that your program is single-threaded, right? It does each connection in order. You have the listen set to 5, so if you get more than 5 requests while you are servicing one, the extra ones will get dropped.
Your read of the image files is not optimal. Reading based on newlines is not efficient for a binary file. It will probably go faster if you get the file size and do a single read on it. Also, if you are on Windows, I am pretty sure you have to set binmode.