I'm sending an image of about 800 kB through a socket server to a client,
This is the server code I'm using:
try { File myfile = new File("oeh.jpg"); byte [] data = new byte[(int)myfile.length()]; BufferedInputStream in = new BufferedInputStream(new FileInputStream(myfile)); in.read(data); out = socket.getOutputStream(); out.write(data); out.flush();
When I check the amount of bytes in windows, it's a perfect match, what am I doing wrong here?
Photoshop is telling me:
"Could not complete your request because the JPEG marker segment length is too short, the file may be truncated or incomplete"
Sending a rar also causes the file header to be corrupt