/**
 * 
 */
package mathsquared.resultswizard2;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.Socket;

/**
 * Main class for the application; runs the administrator GUI that handles result entry.
 * 
 * @author MathSquared
 * 
 */
public class ResultsWizard2 {

    /**
     * @param args the command-line arguments; unused
     */
    public static void main (String[] args) {
        // Setup comms
        WaitForConnectionFrame wfcf = new WaitForConnectionFrame();
        Socket sock = wfcf.call();
        InputStream istr;
        OutputStream ostr;
        if (sock != null) { // there is a socket; remote
            try {
                istr = sock.getInputStream();
                ostr = sock.getOutputStream();
            } catch (IOException e) {
                System.out.println("ERROR: I/O error occurred when initializing network communication");
                e.printStackTrace(System.out);
                System.out.println("Exiting...");
                System.exit(0);
                return;
            }
        } else { // local
            istr = new PipedInputStream();
            ostr = new PipedOutputStream();
            try {
                new Display(new PipedInputStream((PipedOutputStream) ostr), new PipedOutputStream((PipedInputStream) istr));
            } catch (IOException e) {
                System.out.println("ERROR: I/O error occurred when initializing display");
                e.printStackTrace(System.out);
                System.out.println("Exiting...");
                System.exit(0);
                return;
            }
        }

        // TODO make sure this side calls the ObjectOutputStream constructor first! otherwise, deadlock results (see Javadoc)
    }

}

@@ -90,32 +90,101 @@
 io.InputStream;%0A
+import java.io.ObjectInputStream;%0Aimport java.io.ObjectOutputStream;%0A
 import java.io.O
@@ -188,32 +188,32 @@
 o.OutputStream;%0A
-
 import java.io.P
@@ -288,16 +288,49 @@
 ocket;%0A%0A
+import javax.swing.JOptionPane;%0A%0A
 /**%0A * M
@@ -449,16 +449,16 @@
  * %0A */%0A
-
 public c
@@ -480,16 +480,87 @@
 ard2 %7B%0A%0A
+    private ObjectOutputStream out;%0A    private ObjectInputStream in;%0A%0A
     /**%0A
@@ -1901,13 +1901,8 @@
   //
- TODO
  mak
@@ -2008,16 +2008,377 @@
 avadoc)%0A
+        ObjectOutputStream objOut = null;%0A        ObjectInputStream objIn = null;%0A        try %7B%0A            objOut = new ObjectOutputStream(ostr);%0A            objIn = new ObjectInputStream(istr);%0A        %7D catch (IOException e) %7B%0A            JOptionPane.showMessageDialog(null, %22An I/O error occurred: %22 + e.getMessage());%0A            System.exit(1);%0A        %7D%0A
     %7D%0A%0A%7D

Add code to main to initialize object streams