I am working on live device to server streaming in android. I am able to send data in bytes on server but when i play that file during recording on server VLC
You got a problem. The 'moov' box is a kind of table of contents. If not all content is there you can't have a complete table of contents. Ouch!
If you want to stick with MP4 and if you are writing the file by yourself you could write the file as so called fragmented MP4 file. A fragmented MP4 file contains multiple self-contained small pieces of the video - each with its own table of contents. It would enable you to play the file before the complete recording has finished.
If you don't need to stick with MP4 an option would be to write the raw h264 stream to the server. Then you don't have that kind of table of content. VLC can play raw h264 streams.
Use MP4Box to move MOOV atom at begening of file and interleaving to stream in chunk.
MP4Box test.mp4 test.mp4