Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HttpURLConnection's getContent()

Status
Not open for further replies.

igowi

Programmer
Sep 18, 2001
45
0
0
US
What this result means?
***********************************************
main
{
URL url = new URL (HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println (connection.getContent());

URL url = new URL (HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println (connection.getContent());

URL url = new URL (HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println (connection.getContent());
}
************************************
main{
URL url = new URL (http:/HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println(connection.getContent());
}
*************************************
to run first one and to run second one three times
has different output.
After executing first program,
java.io.pushBackInputStream@345
java.io.pushBackInputStream@478
java.io.pushBackInputStream@890

After excuting second program first time,
java.io.pushBackInputStream@345
After executing second program second time,
java.io.pushBackInputStream@345
After executing second program third time,
java.io.pushBackInputStream@345

1.What I am wondering is
in one program, the connection has unique output.
that means a lot of connections are connected while the program is alive. The more threads are executed, the more different connections are made. Is there any limitation for this number of connections on one URL. Because I create this HttpURLConnection instances a lot.

2. what's the meaning of the content of getContent()?

3. connection.disconnect() makes the connection unavailable?

4. while the program is running, the connection is still available?

it's hard to understand for you what I am asking?
please ask me again.

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top