Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>On which point does HTTPURLConnection try to establish a connection to the given URL?</p> </blockquote> <p>On the port named in the URL if any, otherwise 80 for HTTP and 443 for HTTPS. I believe this is documented.</p> <blockquote> <p>On which point can I know that I was able to successfully establish a connection?</p> </blockquote> <p>When you call getInputStream() or getOutputStream() or getResponseCode() without getting an exception.</p> <blockquote> <p>Are establishing a connection and sending the actual request done in one step/method call? What method is it?</p> </blockquote> <p>No and none.</p> <blockquote> <p>Can you explain the function of getOutputStream and getInputStream in layman's term?</p> </blockquote> <p>Either of them first connects if necessary, then returns the required stream.</p> <blockquote> <p>I notice that when the server I'm trying to connect to is down, I get an Exception at getOutputStream. Does it mean that HTTPURLConnection will only start to establish a connection when I invoke getOutputStream? How about the getInputStream? Since I'm only able to get the response at getInputStream, then does it mean that I didn't send any request at getOutputStream yet but simply establishes a connection? Do HttpURLConnection go back to the server to request for response when I invoke getInputStream?</p> </blockquote> <p>See above.</p> <blockquote> <p>Am I correct to say that openConnection simply creates a new connection object but does not establish any connection yet?</p> </blockquote> <p>Yes.</p> <blockquote> <p>How can I measure the read overhead and connect overhead?</p> </blockquote> <p>Connect: take the time getInoutStream() or getOutputStream() takes to return, whichever you call first. Read: time from starting first read to getting the EOS.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload