title: serversocket.accept() method blocks even after connection is established
body: <p>server </p>
  
  <pre><code>    public class Server {
  
  class ServerHelper implements Runnable
      {
          InputStream is;
          private InputStreamReader isr;
          private BufferedReader br;
  
          public ServerHelper(InputStream is) {
              this.is  = is;
              isr = new InputStreamReader(is);
              br = new BufferedReader(isr);
          }
  
  
  
           private void display() throws IOException {
  
              String s = "";
              System.out.print("client says : ");
              while ( ( s = br.readLine() ) != null ) {                
                  System.out.print(s + " ");
              }
          }
  
          @Override
          public void run() {
              try {
                  display( );
              } catch (IOException ex) {
                  Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
              }
          }
  
          void start( ) throws Exception{
            ServerSocket ss = new ServerSocket(5555);
  
               while (true) {            
                  System.out.println("waiting for conn..");
                Socket accept =   ss.accept();//code hangs over here and doesn't proceed ahead
  
                   if( accept == null )
                       System.out.println("got null...");
                   System.out.println("got the client req...");
                   ServerHelper sh = new ServerHelper(accept.getInputStream());
                   Thread t = new Thread(sh);
                   t.start();
               }
  
          }
  
           public static void main(String[] args) {
               try {
                  // TODO code application logic here
                  new Server().start();
               } catch (Exception ex) {
                   Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
              }
           }
  </code></pre>
  
  <p>client </p>
  
  <pre><code>public class Client {
  
  void start( ) throws Exception{
      System.out.println("enter window size ");
      Scanner sc = new Scanner(System.in);
      int wsize = sc.nextInt();
      Socket s = new Socket("127.0.0.1", 5555);
      System.out.println("is connected .." + s.isConnected());
  
      OutputStream outputStream = s.getOutputStream();
      PrintWriter pw = new PrintWriter(outputStream);
      String c  = "y";
      int j = 0;
      do{
          String se = "";
          for (int i = 0; i &lt; wsize; i++) {
              j++;
              se = se + String.valueOf(j);
  
          }
          pw.println(se);
          pw.flush();
  
          System.out.println("do u wanna send more....?(y|n)");
          c =  sc.next();
      }while( c.equalsIgnoreCase("y") );
  
  }
  public static void main(String[] args) {
      try {
          // TODO code application logic here
          new Client().start();
      } catch (Exception ex) {
          Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>Socket accept =   ss.accept();
  </code></pre>
  
  <p>here my code hangs up i know it is blocking io, but at the client side i did verify that whether client is connected or not but it is showing connected...whats the matter with accept() ? I code in similar manner for all my TCP applications but this is weird ..can any one help</p>
  
  <p>I have also added the ServerHelper code for those who want take a look at that class please..</p>