title: Write to socket directly and get TCP ZeroWindow
body: <p>Just as you can see, I send a request to the specific socket every 10 seconds directly( to remain alive and be detected ), but it can only send twice. Using wireshark, I found that the third package I send has <code>TCP ZeroWindow</code> and it cannot send to the server. So does the following packages. Usually, the Window Size should remain at a normal level instead of decreasing all the time. What's wrong with the source code? Any help appreciated!</p>
  
  <p><strong><em>Three packages I got:</em></strong></p>
  
  <p><img src="https://i.stack.imgur.com/BC76r.png" alt="The First Package">
  <img src="https://i.stack.imgur.com/v02Oz.png" alt="The Second Package">
  <img src="https://i.stack.imgur.com/KwujM.png" alt="The Third Package"></p>
  
  <p><strong><em>Source code: very simple</em></strong></p>
  
  <pre><code>public class pediy {
  
      public static void main(String[] args) throws IOException {
  
          URL url = new URL("http://bbs.pediy.com");
          Socket socket = null;
          PrintWriter os = null;
          BufferedReader is = null;
  
          while(true) {
  
              socket = new Socket(url.getHost(), 80);
              os = new PrintWriter(socket.getOutputStream());
  
              String request = "GET / HTTP/1.1\nHost: bbs.pediy.com\nProxy-Connection: keep-alive\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\nUser-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17 CoolNovo/2.0.6.12\nAccept-Encoding: gzip,deflate,sdch\nAccept-Language: en-US;q=0.6,en;q=0.4\nAccept-Charset: utf-8;q=0.7,*;q=0.3\n";
              try {
                  while (true) {
  
                      os.println(request);
                      os.flush();
  
                      System.out.println("Finished");
                      Thread.sleep(1000*10);
                  }
  
              } catch (Exception e) {
                  System.out.println("Error" + e);
              } finally {
                  CloseAll(socket, os);
              }
          }
      }
  
      private static void CloseAll(Socket socket, PrintWriter os) throws IOException {
          if(socket != null) socket.close();
          if(os != null) os.close();
      }
  }
  </code></pre>