public static void main(String str)
//Get Systems current ip address
System.out.println(“Server is Running with “+ myIp +”:”+ port);
//Create Server Socket
ServerSocket welcome = new ServerSocket(port);
//Accept incomming connection Socket
Socket sskt = welcome.accept();
PrintWriter out = new PrintWriter(sskt.getOutputStream());
//Create MIME type to describe that, This is HTML Code
out.println(“HTTP/1.1 200 OK”);
//Write your HTML Code Here
out.println(“Hello world “);
What is MIME type?
MIME stands for Multi-purpose Internet Mail Extensions. MIME types form a standard way of classifying file types on the Internet. Internet programs such as Web servers and browsers all have a list of MIME types, so that they can transfer files of the same type in the same way, no matter what operating system they are working in.
A MIME type has two parts: a type and a subtype. They are separated by a slash (/). For example, the MIME type for Microsoft Word files is application and the subtype is msword. Together, the complete MIME type is application/msword.