成都公司:成都市成華區(qū)建設南路160號1層9號
重慶公司:重慶市江北區(qū)紅旗河溝華創(chuàng)商務大廈18樓
當前位置:工程項目OA系統(tǒng) > 泛普各地 > 遼寧OA系統(tǒng) > 沈陽OA系統(tǒng) > 沈陽OA快博
如何建立持久HTTP連接
下面的代碼寫在doGet或者doPost中:
response.setContentType("text/html; charset=GBK");
String result = "";
DataOutputStream ds = new DataOutputStream(response.getOutputStream());
while(true){
try{
result = "中文字符串ABC";
ds.write(result.getBytes());
ds.flush();
}catch(IOException e){
break; }
try{Thread.sleep(1000);}
catch(InterruptedException ex){}
}

