I got working server and client applications, they work perfect while sending small files, but when I try to send for example movie file that is 700mb over socket it gives m
The problem is that in your client you create a byte array for the entire file.
byte[] fileLength = new byte[(int) file.length()]; //potentially huge buffer allocated here
You should do the same thing you do on the server side and read the file chunk by chunk into a fixed size buffer.