I’m playing around with SpiderMonkey and am experiencing an issue with the Server
class that is almost 100% just a situation where I’m missing something or misconfiguring something.
I have a GitHub project that reproduces my issue entirely here. The TL;DR is the main driver class:
public class ServerApp extends SimpleApplication {
public static void main(String[] args) {
new ServerApp().start(JmeContext.Type.Headless);
}
@Override
public void simpleInitApp() {
System.out.println("Starting up!");
AppSettings appSettings = new AppSettings(true);
appSettings.setTitle("My Server");
appSettings.setUseInput(false);
setSettings(appSettings);
Server server = null;
try {
server = Network.createServer(9201);
} catch(Throwable t) {
System.out.println("An exception occurred: " + t.getMessage());
}
return;
}
}
When you run this (in my project via ./gradlew run
) everything starts up w/out errors or exceptions being thrown. However, when I attempt to see something running on that port I either see nothing or I get errors. For instance if I run netstat -an | grep 9201
I see no output at all (nothing listening).
If I run telnet localhost 9201
I see:
telnet localhost 9201
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
So clearly nothing is running. Can anybody spot where I’m going awry?