title: Connection not establish in for client server program
body: <p>I am very new to socket programming for java. I have develop a simple client server program which involve actionListener. The connection can't be establish once the join button being click, my client program didn't response anything to me. When I run my server program first, the server program response some initial message in the program to indicate that the server is starting, but when I run my client program and try to connect to the server, it will not response anything. Beside, the program is testing using two CMD in my PC </p>
  
  <p>I try several method such as flush(), close() and it also not working <br>
  <a href="https://stackoverflow.com/questions/19807028/simple-client-server-program-not-working">Simple client server program not working</a>  <br>This is one of my reference source for my problem </p>
  
  <p>This is one part of my client program </p>
  
  <pre><code>public void actionPerformed(ActionEvent e)
  {
      if(e.getSource()==btn1)
      {
         try
          {
             Socket s = new Socket("127.0.0.1",8888); //initialize the socket in client
             DataInputStream input = new DataInputStream(s.getInputStream()); // receive message from server 
             DataOutputStream output = new DataOutputStream(s.getOutputStream());  // send the message to server 
             String word = input.readUTF(); // read the input from server 
             JOptionPane.showMessageDialog(null,word);       // display the message
             output.flush();
             output.close();
             btn2.setVisible(true);
             btn3.setVisible(true);
             btn4.setVisible(true);   
          }
          catch(IOException exp)
          {
              JOptionPane.showMessageDialog(null,"Client : Can't Connect To Server, Please Try Again");
          }
  
      } 
  </code></pre>
  
  <p>This is my server program <br>
  <a href="http://codepad.org/AlUr9Qi1" rel="nofollow noreferrer">http://codepad.org/AlUr9Qi1</a></p>