Starting jME3 Server but nothing is listening

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?

You didn’t start the server.

There should be tutorials for this.

You can also look at fully working projects here:

Simple network base with a simple host/connect menu:

More complex example that implement a simple “game” using the SimEthereal object synching library:

The Entity System version of that example:

Actually, given the point you are at and the problems you are experiencing… you can also look at the TestChatServer and TestChatClient that comes with the JME test bundle. It shows the very most basic network setup.

Uggghhhhhhhhhhh (hangs head in shame)

:thumbsup: @pspeed