Recently, i was trying to write a program in Java language on media streaming while reading O'Reilly's "Java Network Programming", by Elliotte Rusty Harold. My program did not work properly, however, and i had asked many people for advice but still helpless. So i would like to ask for professional suggestions from you.

----------------------------------
1)Architecture:
Streaming Server <--> Streaming Engine <--> RealPlayer
Streaming Server sends TCP packets to Streaming Engine, while http connection exists between Streaming Engine and RealPlayer.

2)Workflow
Streaming Engine waits for http request from the realplayer

-> after receiving http request from realplayer, Streaming Engine builds TCP connection with Streaming Server

->Streaming Server sends binary packets from a video(with file extention .rm) to Streaming Engine, at the same time, Streaming Engine stores received packets to a newly created file(result.rm).

->After some time, the Streaming Engine sends a http respone to the realplayer:
String string = "HTTP/1.1 200 OK\r\n"
+ "Content-Type: application/octet-stream\r\n"
+ "Content-Length: 30000\r\n\r\n";

followed, by sending stream of binary packets from the newly created file(result.rm) through TCP connection.

3)Problem
The RealPlayer cannot even playback the video, but i realize that the newly created file(result.rm) did contain data and can be playbacked by double-clicking the file.
----------------------------------
Remark: Actually, i think there is no problem between Streaming Server and Streaming Engine, the problem should be between Streaming Engine and RealPlayer.But i just can't figure out where the problem(s) is(are). Please offer me a suggestion.