i wrote a code for download image from the website using URL class in java.The code is working fine.But the problem is after some time it shows- java.net.ConnectException:Connection timed out
.Here i didnt use any proxy server and firewall.some sites gave soln as like change proxy settings or it is firewall problems.Can u give some solution to solve this problem.
manfosys
0
Newbie Poster
Recommended Answers
Jump to Postmanfosys,
Here is a sample.
import java.io.*; import java.net.*; public class Test{ public static void main(String[] args) throws Exception { URL url = new URL("http://www.daniweb.com/forums/member424507.html"); String passwdstring = "username:password"; String encoding = new sun.misc.BASE64Encoder().encode(passwdstring.getBytes()); URLConnection uc = url.openConnection(); uc.setRequestProperty("Authorization", "Basic " + encoding); InputStream content …
All 4 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
bidziilturner
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
manfosys
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.