62,614
社区成员
发帖
与我相关
我的任务
分享
String uri = "http://detail.zol.com.cn/179/178408/param.shtml";
try {
URL url = new URL(uri);
HttpURLConnection conn = null;
boolean isRetry = true;
int timesOfRetry = 0;
while (isRetry)
{
try {
conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5 * 1000);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.connect();
} catch (IOException e) {
if (timesOfRetry == 5) isRetry = false;
++timesOfRetry;
continue;
}
isRetry = false;
}
} catch (MalformedURLException e) {
}