Index: trunk/code/projects/colonet/ColonetClient/Makefile
===================================================================
--- trunk/code/projects/colonet/ColonetClient/Makefile	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/Makefile	(nonexistent)
@@ -1,25 +0,0 @@
-CC = g++
-LD = g++
-FLAGS = -Wall -Wshadow -Wextra
-CONNECTION_FILES = Server.cpp
-CONNECTION_OBJECTS = $(CONNECTION_FILES:.cpp=.o)
-CLIENT_FILES = Client.cpp
-CLIENT_OBJECTS = $(CLIENT_FILES:.cpp=.o)
-COMMANDS_FILES = Commands.cpp Buzzer.cpp Lcd.cpp
-COMMANDS_OBJECTS = $(COMMANDS_FILES:.cpp=.o)
-
-all: client
-
-
-connection: $(CONNECTION_FILES)
-	$(CC) $(FLAGS) -c $(CONNECTION_FILES)
-
-commands: 
-	$(CC) $(FLAGS) -c $(COMMANDS_FILES)
-
-client: connection commands $(CLIENT_FILES)
-	$(LD) -o $@ $(CONNECTION_OBJECTS) $(COMMANDS_OBJECTS) $(CLIENT_FILES) 
-
-
-clean:
-	rm -rf *.o
Index: trunk/code/projects/colonet/ColonetClient/client
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/code/projects/colonet/ColonetClient/client
===================================================================
--- trunk/code/projects/colonet/ColonetClient/client	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/client	(nonexistent)

Property changes on: trunk/code/projects/colonet/ColonetClient/client
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: trunk/code/projects/colonet/ColonetClient/Client.cpp
===================================================================
--- trunk/code/projects/colonet/ColonetClient/Client.cpp	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/Client.cpp	(nonexistent)
@@ -1,73 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- * 3/1/07
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "includes/Server.h"
-#include "includes/Client.h"
-#include "includes/Commands.h"
-#include "includes/Buzzer.h"
-
-
-
-//TODO: figure out why it thinks its connected to the server even if we pick some random IP address
-
-
-int main(int argc, char * argv[])
-{
-  Buzzer buzzer;
-  if (argc < 3)
-    {
-      printf("\nUsage: %s <server address> <port number>\n", argv[0]);
-      exit(0);
-    }
-
-  Server colonetServer(argv[1], argv[2]);
-  if (colonetServer.isError())
-    {
-      printf("There was an error initializing a connection to the server.\nError message: %s\n", colonetServer.getErrorMsg());
-      exit(0);
-    }
-  
-  Commands commands;
-
-  char msgBuffer[MAX_RESPONSE_LEN];
-  char inputBuffer[MAX_INPUT_LENGTH+1];
-  
-  printf("Type \"help\" for information on available commands\n");
-  while(1)
-    {
-      colonetServer.recvMessagesFromServer();
-
-      while(colonetServer.getMsg(msgBuffer, MAX_RESPONSE_LEN) > 0)
-        {
-          //buffer now contains a message the server sent to the client.  do something with it
-        }
-      if (colonetServer.isError())
-        {
-          printf("There was an error:\n%s\n", colonetServer.getErrorMsg());
-          colonetServer.clearError();
-        }
-
-      printf("Enter a command: ");
-      if (fgets(inputBuffer, MAX_INPUT_LENGTH, stdin) == NULL)
-        {
-          printf("There was an error reading from standard input.\n");
-          continue;
-        }
-      if(inputBuffer[0] == '\n')
-        continue;
-
-      if (commands.parseCommand(inputBuffer, colonetServer))
-        {
-          printf("There was an error parsing a command.\n");
-          continue;
-        }
-    }
-  printf("Done.\n");
-}
Index: trunk/code/projects/colonet/ColonetClient/Commands.cpp
===================================================================
--- trunk/code/projects/colonet/ColonetClient/Commands.cpp	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/Commands.cpp	(nonexistent)
@@ -1,120 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  3/22/07
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "includes/Client.h"
-#include "includes/Commands.h"
-
-void Commands::printUsage()
-{
-  printf("\nAvailable commands:\n");
-  printf("buzzer\n");
-  printf("lcd\n");
-  printf("type \"help <command>\" for more information\n\n");
-}
-
-int Commands::parseCommand(char * command, Server server)
-{
-  if (!command)
-    return -1;
-
-  if (strlen(command) > MAX_INPUT_LENGTH)
-    return -1;
-
-  char tempCommand[MAX_INPUT_LENGTH];
-  strcpy(tempCommand, command);
-  char tokens[MAX_TOKENS][MAX_TOKEN_SIZE];
-  int numTokens = 0;
-  if ((numTokens = tokenizeCommand(tempCommand, tokens)) < 1)
-    {
-      return -1;
-    }
-
-  if (strcmp(tokens[0], "help") == 0)
-    {
-      if (numTokens == 1)
-        {
-          printUsage();
-          return 0;
-        }
-      
-      if (strcmp(tokens[1], "buzzer") == 0)
-        {
-          buzzer.printUsage();
-        }
-      else if (strcmp(tokens[1], "lcd") == 0)
-        {
-          lcd.printUsage();
-        }
-    }
-  else if (strcmp(tokens[0], "buzzer") == 0)
-    {
-      if (buzzer.parseCommand(tokens, numTokens, server) < 0)
-        {
-          return -1;
-        }
-    }
-  else if (strcmp(tokens[0], "lcd") == 0)
-    {
-      if (lcd.parseCommand(tokens, numTokens, server) < 0)
-        {
-          return -1;
-        }
-    }
-  else
-    {
-      printf("Invalid command.\n");
-    }
-
-  return 0;
-}
-
-int tokenizeCommand(char* command, 
-                           char tokens[MAX_TOKENS][MAX_TOKEN_SIZE])
-{
-  char* nextToken = command;
-  char* endToken = NULL;
-  int numTokens = 0;
-
-  if (!command) {
-    return -1;
-  }
-
-  while ((endToken = strstr(nextToken, " "))) {
-    *endToken = '\0';
-
-    if (strlen(nextToken) > MAX_TOKEN_SIZE-1) {
-      return -1;
-    }
-
-    strcpy(tokens[numTokens], nextToken);
-
-    numTokens++;
-    nextToken = endToken + 1;
-
-    while (isspace(*nextToken) && *nextToken != '\0') {
-      nextToken++;
-    }
-  }
-
-  if (endToken == NULL && *nextToken != '\0') {
-    int nextTokenLen = strlen(nextToken);
-    if (nextTokenLen > MAX_TOKEN_SIZE-1) {
-      return -1;
-    }
-    if (nextToken[nextTokenLen-1] == '\n')
-      nextToken[nextTokenLen-1] = '\0';
-
-    strcpy(tokens[numTokens], nextToken);
-
-    numTokens++;
-  }
-
-  return numTokens;
-}
Index: trunk/code/projects/colonet/ColonetClient/Buzzer.cpp
===================================================================
--- trunk/code/projects/colonet/ColonetClient/Buzzer.cpp	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/Buzzer.cpp	(nonexistent)
@@ -1,92 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  3/22/07
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "includes/Buzzer.h"
-
-Buzzer::Buzzer()
-{
-}
-
-void Buzzer::printUsage()
-{
-  printf("\nUsage of the \"buzzer\" command:\n");
-  printf("buzzer init\n");
-  printf("buzzer setValue <value>\n");
-  printf("buzzer setFreq <frequency>\n");
-  printf("buzzer chirp\n");
-  printf("buzzer off\n");
-  printf("\n");
-}
-
-
-int Buzzer::parseCommand(char tokens[MAX_TOKENS][MAX_TOKEN_SIZE], int numTokens, Server server)
-{
-  if (numTokens < 2)
-    {
-      printf("Error: The buzzer command did not contain enough fields.\n");
-      return -1;
-    }
-
-  char buffer[MAX_COMMAND_LEN];
-  buffer[0] = '\0';
-  snprintf(buffer,MAX_COMMAND_LEN, "%d ", SEND_TO_ROBOT);
-  int len = strlen(buffer);
-
-  if (strcmp(tokens[1], "init") == 0)
-    {
-      snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d", BUZZER_INIT);
-    }
-  else if (strcmp(tokens[1], "setValue") == 0 || strcmp(tokens[1], "setFreq") == 0)
-    {
-      if (numTokens < 3)
-        {
-          printf("Error: That buzzer command needs arguments.\n");
-          return -1;
-        }
-
-      char * endPtr = NULL;
-      int value = strtol(tokens[2], &endPtr, 10);
-      if (tokens[2][0] == '\0' || *endPtr != '\0')
-        {
-          printf("Error: The specified value was invalid.\n");
-          return -1;
-        }
-      
-      if (strcmp(tokens[1], "setValue") == 0)
-        {
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %d", BUZZER_SET_VAL, value);
-        }
-      else
-        {
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %d", BUZZER_SET_FREQ, value);
-        }
-    }
-  else if (strcmp(tokens[1], "chirp") == 0)
-    {
-      snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d", BUZZER_CHIRP);
-    }
-  else if (strcmp(tokens[1], "off") == 0)
-    {
-      snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d", BUZZER_OFF);
-    }
-  else
-    {
-      printf("Error: invalid buzzer command.\n");
-      return -1;
-    }
-
-
-  //TODO: remove this print later
-  printf("Command being sent to server:\n%s\n", buffer);
-
-  server.sendMsg(buffer);
-
-  return 0;
-}
Index: trunk/code/projects/colonet/ColonetClient/Lcd.cpp
===================================================================
--- trunk/code/projects/colonet/ColonetClient/Lcd.cpp	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/Lcd.cpp	(nonexistent)
@@ -1,159 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  4/12/07
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "includes/Lcd.h"
-#include "includes/Client.h"
-
-Lcd::Lcd()
-{
-}
-
-void Lcd::printUsage()
-{
-  printf("\nUsage of the \"lcd\" command:\n");
-  printf("lcd init\n");
-  printf("lcd clearScreen\n");
-  printf("lcd putByte <byteValue>\n");
-  printf("lcd putChar <character>\n");
-  printf("lcd putString <string>\n");
-  printf("lcd goto <x> <y>\n");
-  printf("lcd putInt <integer>\n");
-  printf("\n");
-}
-
-
-int Lcd::parseCommand(char tokens[MAX_TOKENS][MAX_TOKEN_SIZE], int numTokens, Server server)
-{
-  if (numTokens < 2)
-    {
-      printf("Error: The lcd command did not contain enough fields.\n");
-      return -1;
-    }
-
-  char buffer[MAX_COMMAND_LEN];
-  buffer[0] = '\0';
-  snprintf(buffer, MAX_COMMAND_LEN, "%d ", SEND_TO_ROBOT);
-  int len = strlen(buffer);
-
-  if (strcmp(tokens[1], "init") == 0)
-    {
-      snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d", LCD_INIT);
-    }
-  else if (strcmp(tokens[1], "clearScreen") == 0)
-    {
-      snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d", LCD_CLEAR_SCREEN);
-    }
-  else if (numTokens < 3)
-    {
-      printf("Error: The lcd %s command was invalid or did not contain enough fields.\n", tokens[1]);
-      return -1;
-    }
-  else
-    {
-      if (strcmp(tokens[1], "putByte") == 0)
-        {
-          char * endPtr = NULL;
-          int value = strtol(tokens[2], &endPtr, 10);
-          if (tokens[2][0] == '\0' || *endPtr != '\0')
-            {
-              printf("Error: The specified value was invalid.\n");
-              return -1;
-            }
-          
-          if (value < 0 || value > 255)
-            {
-              printf("Error: The specified byte value was too large.\n");
-              return -1;
-            }
-
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %d", LCD_PUTBYTE, value);
-        }
-      else if (strcmp(tokens[1], "putChar") == 0)
-        {
-          int charLength = strlen(tokens[2]);
-          if (charLength <= 0 || charLength > 1)
-            {
-              printf("Error: The specified character was invalid.\n");
-              return -1;
-            }
-          
-          char character = tokens[2][0];
-          
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %c", LCD_PUTCHAR, character);
-        }
-      else if (strcmp(tokens[1], "putString") == 0)
-        {
-          //TODO: make this faster
-          char stringBuffer[MAX_INPUT_LENGTH];
-          stringBuffer[0] = '\0';
-          for (int i = 2; i < numTokens; i++)
-            {
-              strncat(stringBuffer, tokens[i], MAX_INPUT_LENGTH - strlen(stringBuffer));
-              strcat(stringBuffer, " ");
-            }
-          if ((signed)(strlen(stringBuffer)) > MAX_COMMAND_LEN - len - 3)
-            {
-              printf("Error: The string you want to send is too long.\n");
-              return -1;
-            }
-
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %s", LCD_PUTSTR, stringBuffer);
-        }
-      else if (strcmp(tokens[1], "goto") == 0)
-        {
-          if (numTokens < 4)
-            {
-              printf("Error: Not enough parameters for the goto command.\n");
-              return -1;
-            }
-
-          char * endPtr = NULL;
-          int xValue = strtol(tokens[2], &endPtr, 10);
-          if (tokens[2][0] == '\0' || *endPtr != '\0')
-            {
-              printf("Error: The specified value was invalid.\n");
-              return -1;
-            }
-          endPtr = NULL;
-          int yValue = strtol(tokens[2], &endPtr, 10);
-          if (tokens[2][0] == '\0' || *endPtr != '\0')
-            {
-              printf("Error: The specified value was invalid.\n");
-              return -1;
-            }
-          
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %d %d", LCD_GOTOXY, xValue, yValue);
-        }
-      else if (strcmp(tokens[1], "putInt") == 0)
-        {
-          char * endPtr = NULL;
-          int value = strtol(tokens[2], &endPtr, 10);
-          if (tokens[2][0] == '\0' || *endPtr != '\0')
-            {
-              printf("Error: The specified value was invalid.\n");
-              return -1;
-            }
-          
-          snprintf(buffer+len, MAX_COMMAND_LEN - len, "%d %d", LCD_PUTINT, value);
-        }
-      else
-        {
-          printf("Error: invalid lcd command.\n");
-          return -1;
-        }
-    }
-
-  //TODO: remove this print later
-  printf("Command being sent to server:\n%s\n", buffer);
-  
-  server.sendMsg(buffer);
-
-  return 0;
-}
Index: trunk/code/projects/colonet/ColonetClient/includes/Server.h
===================================================================
--- trunk/code/projects/colonet/ColonetClient/includes/Server.h	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/includes/Server.h	(nonexistent)
@@ -1,61 +0,0 @@
-/**
- *
- * @author Jason Knichel
- *
- * 2/15/07
- */
-
-#ifndef SERVER_H
-#define SERVER_H
-
-#include "../../lib/colonet_defs.h"
-
-#define MAX_ERROR_MSG_LEN 256
-#define MIN_PORT 1024
-#define MAX_PORT 65536
-#define MAX_RESPONSES_QUEUE 8
-#define READ_BUFFER_SIZE (MAX_RESPONSE_LEN * MAX_RESPONSES_QUEUE)
-
-//Error codes
-#define ERROR_SERVER_PARAMETER_NULL -1
-#define ERROR_SERVER_MESSAGE_LENGTH -2
-#define ERROR_SERVER_SOCKET         -3
-#define ERROR_SERVER_SENDING        -4
-#define ERROR_SERVER_READING        -5
-#define ERROR_SERVER_BUFFER_LENGTH  -6
-#define ERROR_SERVER_MESSAGE_TOO_LONG -7
-#define ERROR_SERVER_NOT_ENOUGH_ROOM -8
-#define ERROR_NO_NEWLINE            -9
-
-
-class Server
-{
- public:
-  Server(char * serverAddress, char * port);
-  Server(int ipAdress, unsigned short port);
-
-  //sends a message to the server you are connected to
-  int sendMsg(char * message);
-  //try to read something from the server you are connected to and buffer it
-  int recvMessagesFromServer();
-  //getMsg - returns the next message in the readBuffer
-  int getMsg(char * buffer, int bufferLen);
-
-  int isError();
-  char * getErrorMsg();
-  void clearError();
-
- private:
-  void initializeServer(int ipAddress, unsigned short port);
-
-  int serverSocket;
-  int error;
-  char errorMsg[MAX_ERROR_MSG_LEN];
-
-  char readBuffer[READ_BUFFER_SIZE];
-  int readBufferLength;
-};
-
-
-
-#endif
Index: trunk/code/projects/colonet/ColonetClient/includes/command_defines.h
===================================================================
--- trunk/code/projects/colonet/ColonetClient/includes/command_defines.h	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/includes/command_defines.h	(nonexistent)
@@ -1,15 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  3/22/07
- */
-
-#ifndef COMMAND_DEFINES_H
-#define COMMAND_DEFINES_H
-
-#define MAX_TOKENS 15
-#define MAX_TOKEN_SIZE 30
-
-
-#endif
Index: trunk/code/projects/colonet/ColonetClient/includes/Client.h
===================================================================
--- trunk/code/projects/colonet/ColonetClient/includes/Client.h	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/includes/Client.h	(nonexistent)
@@ -1,14 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- * 3/1/07
- */
-
-
-#ifndef CLIENT_H
-#define CLIENT_H
-
-#define MAX_INPUT_LENGTH 128
-
-#endif
Index: trunk/code/projects/colonet/ColonetClient/includes/Commands.h
===================================================================
--- trunk/code/projects/colonet/ColonetClient/includes/Commands.h	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/includes/Commands.h	(nonexistent)
@@ -1,30 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  3/22/07
- */
-
-#ifndef COMMANDS_H
-#define COMMANDS_H
-
-#include "command_defines.h"
-#include "Server.h"
-#include "Buzzer.h"
-#include "Lcd.h"
-
-class Commands
-{
- public:
-  void printUsage();
-  int parseCommand(char * command, Server colonetServer);
-
- private:
-  Buzzer buzzer;
-  Lcd lcd;
-};
-
-int tokenizeCommand(char * command, char tokens[MAX_TOKENS][MAX_TOKEN_SIZE]);
-
-
-#endif
Index: trunk/code/projects/colonet/ColonetClient/includes/Buzzer.h
===================================================================
--- trunk/code/projects/colonet/ColonetClient/includes/Buzzer.h	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/includes/Buzzer.h	(nonexistent)
@@ -1,22 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  3/22/07
- */
-
-#ifndef BUZZER_H
-#define BUZZER_H
-
-#include "command_defines.h"
-#include "Server.h"
-
-class Buzzer
-{
- public:
-  Buzzer();
-  void printUsage();
-  int parseCommand(char tokens[MAX_TOKENS][MAX_TOKEN_SIZE], int numTokens, Server server);
-};
-
-#endif
Index: trunk/code/projects/colonet/ColonetClient/includes/Lcd.h
===================================================================
--- trunk/code/projects/colonet/ColonetClient/includes/Lcd.h	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/includes/Lcd.h	(nonexistent)
@@ -1,23 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- *  4/12/07
- */
-
-#ifndef LCD_H
-#define LCD_H
-
-#include "command_defines.h"
-#include "Server.h"
-
-class Lcd
-{
- public:
-  Lcd();
-  void printUsage();
-  int parseCommand(char tokens[MAX_TOKENS][MAX_TOKEN_SIZE], int numTokens, Server server);
-
-};
-
-#endif
Index: trunk/code/projects/colonet/ColonetClient/Server.cpp
===================================================================
--- trunk/code/projects/colonet/ColonetClient/Server.cpp	(revision 476)
+++ trunk/code/projects/colonet/ColonetClient/Server.cpp	(nonexistent)
@@ -1,275 +0,0 @@
-/**
- *
- *  @author Jason Knichel
- *
- * 2/15/07
- */
-
-#include "includes/Server.h"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include "../lib/colonet_defs.h"
-
-
-Server::Server(char * serverAddress, char * port)
-{
-  if (!serverAddress)
-    {
-      //TODO: log error message here
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "Server address was null.");
-      return;
-    }
- 
-  struct hostent * host = gethostbyname(serverAddress);
-  if (!host)
-    {
-      //TODO: log error message here
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "Could not look up IP address from server address.");
-      return;
-    }
-
-  int portNum = 0;
-  char * endPtr = NULL;
-  portNum = strtol(port, &endPtr, 10);
-  if (port[0] == '\0' || *endPtr != '\0')
-    {
-      //TODO: log error message here
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "\nThe specified port was invalid.\n");
-      return;
-    }
-  if (portNum < MIN_PORT || portNum > MAX_PORT)
-    {
-      //TODO: log error message here
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "\nThe port must be between %d and %d inclusive.\n", MIN_PORT, MAX_PORT);
-      return;
-    }
-
-  //TODO: test this to make sure the string host->h_addr is the 4 byte ip
-  // and not a string in dot notation
-  int ipAddress = ntohl(atoi(host->h_addr));
-
-  initializeServer(ipAddress, (unsigned short)portNum);
-}
-
-Server::Server (int ipAddress, unsigned short port)
-{
-  initializeServer(ipAddress, (unsigned short)port);
-}
-
-
-int Server::sendMsg(char * message)
-{
-  if (!message)
-    {
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "Message was null when trying to send a message.");
-      return ERROR_SERVER_PARAMETER_NULL;
-    }
-
-  if (strlen(message) > MAX_COMMAND_LEN)
-    {
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "Message was too long.");
-      return ERROR_SERVER_MESSAGE_LENGTH;
-    }
-
-  if (serverSocket < 0)
-    {
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "The socket was not a valid file descriptor.");
-      return ERROR_SERVER_SOCKET;
-    }
-
-  char * sentPoint = message;
-  int needToSend = strlen(sentPoint);
-
-  if (sentPoint[needToSend-1] != '\n')
-    {
-      if (needToSend == MAX_COMMAND_LEN-1)
-        {
-          error = 1;
-          snprintf(errorMsg, MAX_ERROR_MSG_LEN, "The message was not terminated by a newline and there was no room to add one.");
-          return ERROR_NO_NEWLINE;
-        }
-      else
-        {
-          sentPoint[needToSend] = '\n';
-          sentPoint[needToSend+1] = '\0';
-          needToSend++;
-        }
-    }
-  while(needToSend > 0)
-    {
-      int sent = write(serverSocket, sentPoint, needToSend);
-      if (sent < 0)
-        {
-          error = 1;
-          snprintf(errorMsg, MAX_ERROR_MSG_LEN, "There was an error when trying to send the message to the server.");
-          return ERROR_SERVER_SENDING;
-        }
-      needToSend -= sent;
-    }
-
-  return 1;
-}
-
-int Server::recvMessagesFromServer()
-{
-  char message[READ_BUFFER_SIZE];
-  int maxCanRead = READ_BUFFER_SIZE - readBufferLength;
-  
-  if (maxCanRead > 0)
-    {
-      fd_set readSet;
-      FD_ZERO(&readSet);
-      FD_SET(serverSocket, &readSet);
-
-      struct timeval t;
-      memset(&t, 0, sizeof(struct timeval));
-
-      select (serverSocket+1, &readSet, NULL, NULL, &t);
-
-      if (!(FD_ISSET(serverSocket, &readSet)))
-        {
-          return 1;
-        }
-
-      printf("Before read.\n");
-      int numRead = read(serverSocket, message, maxCanRead);
-      printf("After read.\n");
-
-      if (numRead < 0)
-        {
-          error = 1;
-          snprintf(errorMsg, MAX_ERROR_MSG_LEN, "There was an error reading from the server.");
-          return ERROR_SERVER_READING;
-        }
-      memcpy(readBuffer+readBufferLength, message, numRead);
-      readBufferLength += numRead;
-    }
-
-  return 1;
-}
-
-int Server::getMsg(char * buffer, int bufferLen)
-{
-  if (!buffer)
-    {
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "The buffer given to getMsg was null.");
-      return ERROR_SERVER_PARAMETER_NULL;
-    }
-  if (bufferLen < 0 || bufferLen > MAX_RESPONSE_LEN)
-    {
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "The buffer length given to getMsg was invalid.");
-      return ERROR_SERVER_BUFFER_LENGTH;
-    }
-
-  int len = -1;
-  int i;
-  for (i = 0; i < readBufferLength; i++)
-    {
-      if (readBuffer[i] == '\n')
-        {
-          len = i+1;
-          break;
-        }
-    }
-  
-  if (len == -1)
-    {
-      //no message found in buffer
-      return 0;
-    }
-
-  if (len > MAX_RESPONSE_LEN)
-    {
-      //there was a message in the buffer but it was too long
-      memmove(readBuffer, readBuffer+len, readBufferLength - len);
-      readBufferLength -= len;
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "The next message in the buffer was too long.  Removing message from buffer.");
-      return ERROR_SERVER_MESSAGE_TOO_LONG;
-    }
-
-  if (len > bufferLen)
-    {
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "The next message is longer than the buffer it is trying to be stored in.  Leaving message in queue.");
-      return ERROR_SERVER_NOT_ENOUGH_ROOM;
-    }
-
-  //this copies the newline over also into the buffer
-  memcpy(buffer, readBuffer, len);
-  memmove(readBuffer, readBuffer+len, readBufferLength - len);
-  readBufferLength -= len;
-  
-  return 1;
-}
-
-int Server::isError()
-{
-  return error;
-}
-
-char * Server::getErrorMsg()
-{
-  return errorMsg;
-}
-
-void Server::clearError()
-{
-  memset(errorMsg, 0, MAX_ERROR_MSG_LEN);
-  error = 0;
-}
-
-
-
-/******************
- *  Private Methods
- *****************/
-
-//assumes ipAddress and port are in host format
-void Server::initializeServer(int ipAddress, unsigned short port)
-{
-  serverSocket = socket(AF_INET, SOCK_STREAM, 0);
-  if (serverSocket < 0)
-    {
-      //TODO: implement logging system and log error message here
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "Could not create a socket.");
-      return;
-    }
-
-  struct sockaddr_in addr;
-  memset (&addr, 0, sizeof(struct sockaddr_in));
-  addr.sin_family = AF_INET;
-  addr.sin_addr.s_addr = htonl(ipAddress);
-  addr.sin_port = htons(port);
-  
-  if (connect(serverSocket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
-    {
-      //TODO: log error message here
-      close(serverSocket);
-      error = 1;
-      snprintf(errorMsg, MAX_ERROR_MSG_LEN, "Could not connect to server.");
-      return;
-    }
-
-  readBufferLength = 0;
-
-  clearError();
-}
-
