Sdurrani
asked on
Server sockts
Hi there
I am working on the following code and I cannot seem to get it to compile please advise.
I am working on the following code and I cannot seem to get it to compile please advise.
import java.io.*;
import java.net.*;
import java.util.Scanner;
class GetDataFromWebServer {
GetDataFromWebServer () throws IOException;
String address = "http://www.curl.com";
URL u = new URL (address);
URLConnection connection = u.openConnection();
final int HTTP_PORT = 80;
Socket s = new Socket() ;
InputStream ins = s.getInputStream();
OutputStream outs = s.getOutputStream();
Scanner in = new Scanner (ins);
PrintWriter out = new PrintWriterv("outs");
String command = "GET / HTTP/1.0\n\n";
out.print(command);
out.flush ();
while (in.hasNextLine()) {
String line = in.nextLine();
out.println (line);
}
s.close;
public sProxy-Connection: keep-alive Cache-Control: max-age=0 tic void main (String[] args) {
try {
GetDataFromWebServer g = new GetDataFromWebServer();
}
catch (Exception e) {
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.