Search in sources :

Example 1 with RemoteTransmitter

use of org.javatari.atari.network.RemoteTransmitter in project javatari by ppeccin.

the class Room method buildAndPlugServerConsole.

protected ServerConsole buildAndPlugServerConsole() {
    if (serverConsole != null)
        throw new IllegalStateException();
    RemoteTransmitter remoteTransmitter = new RemoteTransmitter();
    serverConsole = new ServerConsole(remoteTransmitter);
    plugConsole(serverConsole);
    return serverConsole;
}
Also used : RemoteTransmitter(org.javatari.atari.network.RemoteTransmitter) ServerConsole(org.javatari.atari.network.ServerConsole)

Example 2 with RemoteTransmitter

use of org.javatari.atari.network.RemoteTransmitter in project javatari by ppeccin.

the class JComboBoxNim method serverStartAction.

private void serverStartAction() {
    if (!room.isServerMode()) {
        // Will try to START
        gray(true);
        room.morphToServerMode();
        SwingHelper.edtInvokeLater(new Runnable() {

            @Override
            public void run() {
                setupConnectionStatusListeners();
                try {
                    RemoteTransmitter transmitter = room.serverCurrentConsole().remoteTransmitter();
                    String portString = serverPortTf.getText().trim();
                    try {
                        if (portString.isEmpty())
                            transmitter.start();
                        else
                            transmitter.start(Integer.valueOf(portString));
                    } catch (NumberFormatException e) {
                        throw new IllegalArgumentException("Invalid port number: " + portString);
                    }
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(null, "Could not start Server:\n" + ex, "javatari P1 Server", JOptionPane.ERROR_MESSAGE);
                    room.morphToStandaloneMode();
                }
                refreshMultiplayer();
                gray(false);
            }
        });
    } else {
        // Will try to STOP
        try {
            RemoteTransmitter transmitter = room.serverCurrentConsole().remoteTransmitter();
            transmitter.stop();
            room.morphToStandaloneMode();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Error stopping Server:\n" + ex, "javatari P1 Server", JOptionPane.ERROR_MESSAGE);
        }
        refreshMultiplayer();
    }
}
Also used : RemoteTransmitter(org.javatari.atari.network.RemoteTransmitter) ROMFormatUnsupportedException(org.javatari.atari.cartridge.ROMFormatUnsupportedException) IOException(java.io.IOException)

Aggregations

RemoteTransmitter (org.javatari.atari.network.RemoteTransmitter)2 IOException (java.io.IOException)1 ROMFormatUnsupportedException (org.javatari.atari.cartridge.ROMFormatUnsupportedException)1 ServerConsole (org.javatari.atari.network.ServerConsole)1