I have built a client socket to get the web page from the server. When i output the result the images will not be shown. How can i get the images to show of the requested web page?
this is the code of my client:
try {
InetAddress addr = InetAddress.getByName(args);
URL url = new URL(args);
int getport = url.getPort();
int port = 80;
SocketAddress sockaddr = new InetSocketAddress(addr,port);
Socket socket = new Socket();
int timeoutMS = 2000;
socket.connect(sockaddr,timeoutMS);
boolean autoflash = true;
PrintWriter out = new PrintWriter(socket.getOutputStream(),autoflash);
InputStream inputStream = socket.getInputStream();
InputStreamReader isReader = new InputStreamReader(inputStream);
BufferedReader rd = new BufferedReader(isReader);
out.println("GE" + args + "HTTP/1.1");
out.println("HOST: localhost:80");
out.println("connection: closed");
out.println();
String s = null;
while ((s = rd.readLine()) != null)
System.out.println(s);
rd.close();
} catch (MalformedURLException ex) {
} catch (UnknownHostException ex) {
} catch (IOException ex) {
}
}