This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

where can I find an example to use socket to read a web page?  RSS feed

 
Allen Chan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where can I find an example to use socket to read a web page? I use URL before but can't specifiy the time out.

any ideas?
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set the timeout of URL/URLConnection via the sun.net.client.defaultConnectTimeout system property. Take a look at
Networking Properties - Java 1.5.0 for more options.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://jakarta.apache.org/commons/httpclient/ supports connection timeouts and at the same time saves you from having to handle all the low level details.

Moving to Sockets and Internet Protocols...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!