HTTPConnection执行的时间及其状态



我有下面的代码,它从HttpURLConnection生成OutputStream实际执行连接的时间以及如何检查其状态?

  HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
  httpCon.setDoOutput(true);
  httpCon.setRequestMethod("PUT");
  httpCon.addRequestProperty("X-Auth-Token", getAuthToken());
  httpCon.setDoInput(true);
  httpCon.setRequestProperty("Connection", "close");
  httpCon.setReadTimeout(READ_TIMEOUT);
  httpCon.setRequestProperty("Transfer-Encoding","chunked");
  httpCon.setDoOutput(true);
  httpCon.setChunkedStreamingMode(STREAMING_CHUNK);
  mOutputStream  = httpCon.getOutputStream();

当您获得其中一个流或响应代码或调用connect()时,将创建(或从连接池中分配)底层TCP连接。HttpURLConnection对象本身不是TCP连接。

相关内容

  • 没有找到相关文章

最新更新