title: Solve the problem of not being able to transfer files
body: <p>I have studied creating a chat program from a tutorial site and I applied all of the above in the explanation but I have a problem is the inability to transfer files and images between the server and the client.
  This code is used in chat.
  I've done a lot of experiments, but I can't solve the problem. </p>
  
  <p>MessageList:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public class MessageList extends Thread{
    
     ServerSocket srever;
     int port=1000;
     WritableGUI gui;
         private ObjectOutputStream out;
  
     public MessageList(WritableGUI gui,int port){
     
         this.port=port;
         this.gui=gui;
         try {
             srever=new ServerSocket(port);
         } catch (IOException e) {
             Logger.getLogger(MessageList.class.getName()).log(Level.SEVERE, null, e);
         }
         
     }
     
     
  
  
      
     
     
     @Override
     public void run(){
         Socket clientSocket;
         try {
             while ((clientSocket=srever.accept())!=null) {               
                 InputStream is = clientSocket.getInputStream();
                BufferedReader br = new BufferedReader(new InputStreamReader(is));
                String line = br.readLine();
               
                if(line !=null){
                    gui.write(line);
                }
             }
             
         } catch (Exception e) {
                        Logger.getLogger(MessageList.class.getName()).log(Level.SEVERE, null, e);
         }
      
    
     }
  
  
  }</code></pre>
  </div>
  </div>
  
  Message:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public class MessageTransmitter extends Thread{
      
      String message , hostname;
      int port=1000; 
   int filesize=2022386; 
          int bytesRead;
          int currentTot = 0;
      public MessageTransmitter(){
          
      }
      
      public MessageTransmitter(String message ,String hostname,int port ){
          this.message=message;
          this.hostname=hostname;
          this.port=port;
      }
   @Override
   public void run(){
       try {
             Socket s =new Socket(hostname,port);
             s.getOutputStream().write(message.getBytes());
             
             s.close();
            
         } catch (IOException e) {
             Logger.getLogger(MessageTransmitter.class.getName()).log(Level.SEVERE, null, e);
         }
       
   
   }
  
  
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>WritableGUI  :
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public interface WritableGUI  {
      void write(String s);
      
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Please help me solve this problem. </p>