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;
}
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();
}
}
Aggregations