Search in sources :

Example 1 with RemoteReceiver

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

the class JComboBoxNim method clientConnectAction.

private void clientConnectAction() {
    if (!room.isClientMode()) {
        // Will try to CONNECT
        gray(true);
        room.morphToClientMode();
        SwingHelper.edtInvokeLater(new Runnable() {

            @Override
            public void run() {
                setupConnectionStatusListeners();
                String serverAddress = "";
                try {
                    RemoteReceiver receiver = room.clientCurrentConsole().remoteReceiver();
                    serverAddress = clientServerAddressTf.getText().trim();
                    receiver.connect(serverAddress);
                    closeAction();
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(null, "Connection failed: " + serverAddress + "\n" + ex, "javatari P2 Client", JOptionPane.ERROR_MESSAGE);
                    room.morphToStandaloneMode();
                }
                refreshMultiplayer();
                gray(false);
            }
        });
    } else {
        // Will try to DISCONNECT 
        try {
            RemoteReceiver receiver = room.clientCurrentConsole().remoteReceiver();
            receiver.disconnect();
            room.morphToStandaloneMode();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Error disconnecting from Server:\n" + ex, "javatari P2 Client", JOptionPane.ERROR_MESSAGE);
        }
        refreshMultiplayer();
    }
}
Also used : RemoteReceiver(org.javatari.atari.network.RemoteReceiver) ROMFormatUnsupportedException(org.javatari.atari.cartridge.ROMFormatUnsupportedException) IOException(java.io.IOException)

Example 2 with RemoteReceiver

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

the class Room method buildAndPlugClientConsole.

protected ClientConsole buildAndPlugClientConsole() {
    RemoteReceiver remoteReceiver = new RemoteReceiver();
    clientConsole = new ClientConsole(remoteReceiver);
    plugConsole(clientConsole);
    return clientConsole;
}
Also used : RemoteReceiver(org.javatari.atari.network.RemoteReceiver) ClientConsole(org.javatari.atari.network.ClientConsole)

Aggregations

RemoteReceiver (org.javatari.atari.network.RemoteReceiver)2 IOException (java.io.IOException)1 ROMFormatUnsupportedException (org.javatari.atari.cartridge.ROMFormatUnsupportedException)1 ClientConsole (org.javatari.atari.network.ClientConsole)1