Java tutorial
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; public class Main { public static void main(String args[]) throws Exception { ServerSocket serverSocket = new ServerSocket(8080); Socket socket = serverSocket.accept(); InputStream inStream = socket.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inStream)); String str = null; while ((str = reader.readLine()) != null) { System.out.println(str); } } }