Hello,
I would require a passive Server without updateloop. Mainly for managing loginData and giving out a serverlist to the clients.
Is it even possible to start a Server without extending SimpleApplication and so without the updateloop?
I am thinking of something like:
[java]
public class ServerStart {
public static void main(String args[]){
try {
Server myServer=Network.createServer(ServerInfo.MasterServerPort);
myServer.start();
} catch (IOException ex) {
Logger.getLogger(ServerStart.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
[/java]
The question is, is this even possible (does the Server require SimpleApplication?) ?
If yes, is there a way of letting the program run without implementing some kind of endless loop?
The spidermonkey server Does NOT require simple application. What you are suggesting is fine
I believe you are looking for something like this
[java] public static void main(String[] args)
{
final Server Server = Network.createServer(ServerInfo.MasterServerPort);
Runnable main = new Runnable()
{
@Override
public void run()
{
Server.start();
while (true)
{
synchronized (Server)
{
try
{
Server.wait();
}
catch (InterruptedException ex)
{
// logger.error("Error In Login Server main");
}
}
}
}
};
new Thread(main).start();
}[/java]
You can also go with an approach where you have a simple console command line. After you initialize the server do something like:
[java]
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = null;
while( (line = in.readLine()) != null ) {
if( "exit".equals(line) ) {
break;
}
}
// Gracefully shut down the server
[/java]