HTTP Webserver Using Java

import*;import*;class myserver{public static void main(String str[]){String myIp=null;int port=786;try{//Get Systems current ip addressmyIp= Inet4Address.getLocalHost().getHostAddress();System.out.println(“Server is Running with “+ myIp +”:”+ port);//Create Server SocketServerSocket welcome = new ServerSocket(port);//Accept incomming connection SocketSocket sskt = welcome.accept();PrintWriter out = new PrintWriter(sskt.getOutputStream());//Create MIME type to describe that, This is HTML Codeout.println(“HTTP/1.1 200 OK”);out.println(“Content-Type: text/html”);out.println(“rn”);//Write your HTML Code Hereout.println(“Hello worldn”);out.flush();out.close();}catch(Exception

Download webpage using java server socket.

Download webpage using java server socket.¬† import*;import*;class readWebPage{public static void main(String arg[]){try{Socket s = new Socket(“″,8090);String line=””;BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));PrintWriter out = new PrintWriter(s.getOutputStream());out.print(“GET /httpclient.htmlnn”);out.flush();System.out.println(“Reading File”);while((line = in.readLine())!=null){System.out.println(line);}} catch(Exception e){System.out.println(e.toString());}}}

Demo of I18N (Internationalization) with JAVA

I18N is called Internationalization, which supports Multiparty language in your software. again its not convert one language to other language but Display selected language from “Properties” file. Crate file Copy the following code.   ¬†import java.util.*; public class I18nDemo { private static Locale aLocale; private static Locale frLocale; private static ResourceBundle Message; public static

Make your own Java webServer

import*; import*; class myserver { public static void main(String str[]) { String myIp=null; int port=786; try{ //Get Systems current ip address myIp= Inet4Address.getLocalHost().getHostAddress(); 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