I'm making a chat program with Java, and I'm doing the communication through TCP and serializable objects. The chat can exchange files, too, but when the files are too big (video files) the interface freezes until it completes the file loading and object transmition process. I need to show a message while the file is being loaded. This is my code:
File file = jFileChooser1.getSelectedFile(); String name= fichero.getName(); int size = (int)fichero.length(); byte[] byteArray = new byte[size]; try { BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); bis.read(byteArray); } catch (IOException ex) { Logger.getLogger(Explorador.class.getName()).log(Level.SEVERE, null, ex); } I need to show a message while this line "bis.read(byteArray);" is reading, since I believe that line is the reason the interface freezes. After the byteArray is loaded I put it on a object and send it through the socket connection.
I also need a video streaming, not live, just to open a video file on the server and send it by pieces to the connected clients and play it. Can anyone give me tutorials or tips? thanks.