07 HTTP
Initial Steps¶
- Go to Windows Features
- Turn on
Internet Information Services
- Host the web page
- Go to
Windows (C:)>inetpub>wwwroot
- Add a file called
index.html
-
Type your html code
-
Perform Execution
Client.java
¶
import java.util.*;
import java.io.*;
import java.net.*;
public class Client
{
public static void main(String[] args) throws IOException
{
String server = args[0];
int port = Integer.parseInt(args[1]);
try
{
Socket socket = new Socket(server, port);
DataOutputStream request = new DataOutputStream(socket.getOutputStream());
request.writeUTF("\n");
DataInputStream response = new DataInputStream(socket.getInputStream());
String response_text = response.readUTF();
while(response_text != null)
{
System.out.println(response_text);
response_text = response.readUTF();
}
request.close();
response.close();
socket.close();
} catch (Exception e)
{
e.printStackTrace();
}
}
}