public Coord[] read(int mode)
        {
                if (mode < Labview.MODE_3D || mode > Labview.MODE_2D)
                {
                        error("Invalid MODE was given.", "Labview", "read");
                        return null;
                }
                if (!socket.isConnected() || !isConnected())
                {
                        error("The connection to labview was lost.", "Labview", "read");
                        return null;
                }
                String command = "s";
                debug("Sending command: " + command);
                String lastResponse = "";
                try
                {
                        write.write(command);
                        write.flush();
                        sleep(200);
                        while (read.ready())
                                lastResponse += (char) read.read();
                        lastResponse = lastResponse.substring(lastResponse.indexOf("[") + 1, lastResponse.indexOf("]"));
                        String[] parts = lastResponse.split(",");
                        if (mode == Labview.MODE_3D)
                        {
                                debug("Creating Coord (3D mode): (" + parts[0] + ", " + parts[1] + ", " + parts[2] + ")");
                                Coord[] ans =
                                {
                                        new Coord(Double.parseDouble(parts[0]), Double.parseDouble(parts[1]), Double.parseDouble(parts[2]))
                                };
                                return ans;
                        }
                        else if (mode == Labview.MODE_2D)
                        {
                                debug("Creating two Coords (2D mode): (" + parts[0] + ", " + parts[1] + ") and (" + parts[2] + ", " + parts[3] + ")");
                                Coord[] ans =
                                {
                                        new Coord(Double.parseDouble(parts[0]), Double.parseDouble(parts[1]), -1.0), new Coord(Double.parseDouble(parts[2]), Double.parseDouble(parts[3]), -1.0)
                                };
                                return ans;
                        }
                }
                catch (NumberFormatException e)
                {
                        debug("Labview returned: " + lastResponse + " and determined it not to be a number.  (method: read())");
                }
                catch (Exception e)
                {
                        error("A generic error occurred.  Message: " + e.toString(), "Labview", "connect");
                }
                return null;
        }