I don't know what it means :/
Code:
// This file is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License version 2, 1991 as published by
// the Free Software Foundation.
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
// A copy of the GNU General Public License can be found at:
// http://www.gnu.org/licenses/gpl.html
public class server implements Runnable {
/**
* The task scheduler.
*/
private static final TaskScheduler scheduler = new TaskScheduler();
/**
* Gets the task scheduler.
* @return The task scheduler.
*/
public static TaskScheduler getTaskScheduler() {
return scheduler;
}
public server()
{
// the current way of controlling the server at runtime and a great debugging/testing tool
//jserv js = new jserv(this);
//js.start();
}
// TODO: yet to figure out proper value for timing, but r seems good
public static final int cycleTime = 600;
public static void main(java.lang.String args[]) {
clientHandler = new server();
(new Thread(clientHandler)).start();
scheduler.schedule(new Task() {
@Override
protected void execute() {
playerHandler.process();//line 47p
}
});
}
public static server clientHandler = null; // handles all the clients
public static java.net.ServerSocket clientListener = null;
public static boolean shutdownServer = false; // set this to true in order to shut down and kill the server
public static boolean shutdownClientHandler; // signals ClientHandler to shut down
public static int serverlistenerPort = 43594; //43594=default
public static PlayerHandler playerHandler = null;
public static IOThread ioThread = null;
public void run() {
// setup the listener
try {
shutdownClientHandler = false;
clientListener = new java.net.ServerSocket(serverlistenerPort, 1, null);
misc.println("Starting server on "+clientListener.getInetAddress().getHostAddress()+":" + clientListener.getLocalPort());
while(true) {
java.net.Socket s = clientListener.accept();
s.setTcpNoDelay(true);
String connectingHost = s.getInetAddress().getHostName();
if(!IOHostList.has(connectingHost,3)) {
misc.println("ClientHandler: Accepted from "+connectingHost+":"+s.getPort());
playerHandler.newPlayerClient(s, connectingHost);
} else {
misc.println("ClientHandler: Rejected from "+connectingHost+":"+s.getPort());
s.close();
}
}
} catch(java.io.IOException ioe) {
if(!shutdownClientHandler) {
misc.println("Error: Unable to startup listener on "+serverlistenerPort+" - port already in use?");
} else {
misc.println("ClientHandler was shut down.");
}
}
}
public void killServer()
{
try {
shutdownClientHandler = true;
if(clientListener != null) clientListener.close();
clientListener = null;
} catch(java.lang.Exception __ex) {
__ex.printStackTrace();
}
}
}