Java: How does URLConnection handle a completed TCP connection?

When I use URLConnection to execute some HTTP requests, I can only close InputStream and OutputStream, but not the socket.

Does the class automatically close the socket? How it's done? Will the FIN server return or something else?

If I create many threads, including every URLConnection in them, will it automatically reuse the socket? I caught several packets, it shows that every three connections use one socket.

+3
source share
1 answer

, , 5 15 . HttpURLConnection.disconnect() - , .

+1

Source: https://habr.com/ru/post/1795427/


All Articles