import java.net.ServerSocket; import java.net.Socket; /* * Created on Oct 5, 2004 * */ /** * @author Thinh Nguyen * */ public final class RdtReceiver { public static void main(String argv[]) throws Exception { // Get the port number from the command line. int port = (new Integer(argv[0])).intValue(); // Establish the listen socket. ServerSocket socket = new ServerSocket(port); // Process HTTP server requests in an infinite loop. while(true) { // Listen for a TCP connection request. System.out.println("Waiting for connections..."); Socket connection = socket.accept(); System.out.println("Got a connection!"); // Construct an object to process the HTTP request message. RdtRequest request = new RdtRequest(connection); // Create a new thread to process the request. Thread thread = new Thread(request); // Start the thread. thread.start(); } } }