The code writes the array with writeObject() instead of write(). Did you try using write()?

Can you make a small simple program that compiles, executes and shows the problem.