public class HTTPServer { public static void main(String[] args) { ServerSocket socket = null; try { socket = new ServerSocket(5000); } catch (Exception ex0) { System.out.println(ex0.getMessage()); System.exit(1); // exit with error. }
while(true) { // the server waits (using an accept call) for a client to connect. System.out.println("Waiting For Client Connection."); Socket connection = null; try { connection = socket.accept(); } catch (Exception ex1) { System.out.println(ex1.getMessage()); System.exit(1); // exit with error. } System.out.println("Client Connected To Server"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)