Stream images through socket
Posted on 2004-11-28
Okay, here's what I'm trying to achieve:
I am going to install two applications. One on the Client machine, and one on the Server machine.
I want to the user on the server machine to be able to view everything happening on the Client machine (like a video recording of it, and streamed over to the server).
I need to come up with the best method of doing this. I've come up with probably the most logical technique:
Keep printing screen on the client machine, and stream the BufferedImage's to the Server. The server then keeps updating the recieved BufferedImage's to the application (which is a JWindow, that takes up the whole screen).
Would you lot agree that this is the best/only technique of achieving this? If not, I'm open to any other suggestions.
If you agree however, that that's the best technique, then I have a couple of queries:
1) On the server machine, would the best method of constantly outputting the frames to the app be by using a JLabel ? (ie: JLabel jl_output = new JLabel ( [bufferedImage] );).
2) If I use a JLabel to store the frames, what would be the best method of updating it with the new BufferedImage? For example, I don't think that this way updates the display: jl_output = new JLabel ( [newBufferedImage] ); .. Would I need to use: repaint(); to update the display??
3) How would I write the BufferedImages to the Socket? Would I need to generate a byte array ? And write that to the Socket, then turn the Byte array (on the server side) into the BufferedImage ?? If so, anyone got any example code to do this???
I'm open to any and all comments/suggestions.
Thanks in advance! :-)