import java.io.*; import java.net.*; public class Url{ public static void main(String argumendid[]) throws IOException{ ServerSocket ss=new ServerSocket(3001); while(true){ Socket sc=ss.accept(); PrintWriter OutputS=new PrintWriter(sc.getOutputStream(), true); BufferedReader InputSR=new BufferedReader(new InputStreamReader(sc.getInputStream())); OutputS.println("Enter the URL address:"); String url=InputSR.readLine(); PrintWriter FileW2=new PrintWriter(new FileWriter("url.txt")); FileW2.println(url); FileW2.close(); BufferedReader FileR1=new BufferedReader(new FileReader("url.txt")); OutputS.println("Address is:"); String uline=FileR1.readLine(); OutputS.println(uline); FileR1.close(); System.out.println(sc.getInetAddress()); // sc.close(); // BufferedReader FileR2=new BufferedReader(new FileReader("url.txt")); PrintWriter FileW3=new PrintWriter(new FileWriter("html.txt", true)); // String s=FileR2.readLine(); // String adr=s; URL readURL=new URL(uline); BufferedReader FR=new BufferedReader(new InputStreamReader(readURL.openConnection().getInputStream())); String line=FR.readLine(); while(line!=null){ line=FR.readLine(); FileW3.println(line); } FileW3.close(); sc.close(); } } }