java - Write to socket directly and get TCP ZeroWindow -
just can see, send request specific socket every 10 seconds directly( remain alive , detected ), can send twice. using wireshark, found third package send has tcp zerowindow
, cannot send server. following packages. usually, window size should remain @ normal level instead of decreasing time. what's wrong source code? appreciated!
three packages got:
source code: simple
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 = 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, 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); } { closeall(socket, os); } } } private static void closeall(socket socket, printwriter os) throws ioexception { if(socket != null) socket.close(); if(os != null) os.close(); } }
this means other side of tcp connection not consuming (reading) data send, tcp flow control kicks in slow sender down.
Comments
Post a Comment