/**
*
*/
package info.walnutstreet.vs.ps03v2.server;
import info.walnutstreet.vs.ps03v2.server.handler.ClientHandler;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.log4j.Logger;
/**
* @author Christoph Gostner
* @version 0.4
*/
public class Server {
/**
* Logging ...
*/
private static Logger logger = Logger.getLogger(Server.class);
/**
* Start the application server here.
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
try {
int port = Integer.parseInt(args[0]);
ServerSocket serverSocket = new ServerSocket(port);
Server.logger.debug("Application-Server started on port " + port);
while (true) {
Socket socket = serverSocket.accept();
ClientHandler handler = new ClientHandler(socket);
handler.start();
}
} catch (NumberFormatException e) {
Server.logger.error("Please specify a valid port!");
}
}
}