You drop the first read of data on the floor in this line:
int receivedBytes = inStream.read(buffer, 0, buffer.length);
Not really sure what that line of code is for (old debugging?). You basically just need to remove it.
UPDATE:
You seem to indicate that you are sending additional metadata at the beginning of the stream. My guess is that you are using some sort of BufferedInputStream/Reader when reading the initial metadata, and that is swallowing part of the subsequent file data.
You can somewhat solve this problem by wrapping the DataInputStream around the BufferedInputStream you are using to read the metadata. You have to be careful, however, that whatever you are using to read the metadata doesn't read more data than it should. It's actually trickier to do this than you might think. You might want to look at using the DataInput/Output streams exclusively (use writeUTF/readUTF to handle the file name and writeLong/readLong to handle the file size).