Index: common/Message.h
===================================================================
--- common/Message.h	(revision 1a3c42d454335d7396ab52d547ea0f7d241023f3)
+++ common/Message.h	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
@@ -21,5 +21,6 @@
 typedef struct
 {
-   short type;
+   unsigned int id;
+   unsigned short type;
    char buffer[256];
 } NETWORK_MSG;
Index: common/MessageProcessor.cpp
===================================================================
--- common/MessageProcessor.cpp	(revision 1a3c42d454335d7396ab52d547ea0f7d241023f3)
+++ common/MessageProcessor.cpp	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
@@ -1,15 +1,53 @@
 #include "MessageProcessor.h"
 
-int MessageProcessor::sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest) {
-   return 0;
+#include <iostream>
+
+MessageProcessor::MessageProcessor() {
+   lastUsedId = 0;
 }
 
-int MessageProcessor::receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest) {
-   return 0;
+MessageProcessor::~MessageProcessor() {
 }
 
-void MessageProcessor::resendUnackedMessages() {
+int MessageProcessor::sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest) {
+   MessageContainer message(*msg, *dest);
+   message.id = ++lastUsedId;
+   sentMessages[message.id] = message;
+
+   int ret =  sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
+
+   cout << "Send a message of type " << msg->type << endl;
+
+   return ret;
+}
+
+int MessageProcessor::receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *source) {
+   socklen_t socklen = sizeof(struct sockaddr_in);
+
+   // assume we don't care about the value of socklen
+   int ret =  recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, &socklen);
+
+   // add id to the NETWORK_MSG struct
+   if (msg->type == MSG_TYPE_ACK) {
+      sentMessages.erase(msg->id);
+   }else {
+      NETWORK_MSG ack;
+      ack.id = msg->id;
+
+      sendto(sock, (char*)&ack, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, sizeof(struct sockaddr_in));
+   }
+
+   return ret;
+}
+
+void MessageProcessor::resendUnackedMessages(int sock) {
+   map<int, MessageContainer>::iterator it;
+
+   for(it = sentMessages.begin(); it != sentMessages.end(); it++) {
+      sendto(sock, (char*)&it->second.msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)&it->second.clientAddr, sizeof(struct sockaddr_in));
+   }
 }
 
 void MessageProcessor::cleanAckedMessages() {
+   // shouldn't be needed since I can just remove messages when I get their ACKs
 }
Index: common/MessageProcessor.h
===================================================================
--- common/MessageProcessor.h	(revision 1a3c42d454335d7396ab52d547ea0f7d241023f3)
+++ common/MessageProcessor.h	(revision 5a64bea142d5f3694a0dd6c567c632ee4b97c3ee)
@@ -2,5 +2,16 @@
 #define _MESSAGE_PROCESSOR_H
 
+#include <map>
+
+#include "Compiler.h"
+
 #include "Message.h"
+
+#if defined WINDOWS
+   #include <winsock2.h>
+   #include <WS2tcpip.h>
+#elif defined LINUX
+   #include <netinet/in.h>
+#endif
 
 /*
@@ -28,12 +39,46 @@
 */
 
+using namespace std;
+
 class MessageProcessor {
 public:
+   MessageProcessor();
+   ~MessageProcessor();
+
    int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest);
    int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest);
-   void resendUnackedMessages();
+   void resendUnackedMessages(int sock);
    void cleanAckedMessages();
 
 private:
+   // this should eventually just replace the Message struct
+   class MessageContainer {
+   public:
+      MessageContainer() {
+      }
+
+      MessageContainer(const MessageContainer& mc) {
+         this->id = mc.id;
+         this->clientAddr = mc.clientAddr;
+         this->msg = mc.msg;
+         this->ackReceived = mc.ackReceived;
+      }
+
+      MessageContainer(NETWORK_MSG msg, struct sockaddr_in clientAddr) {
+         this->clientAddr = clientAddr;
+         this->msg = msg;
+      }
+
+      ~MessageContainer() {
+      }
+
+      int id;
+      struct sockaddr_in clientAddr;
+      NETWORK_MSG msg;
+      bool ackReceived;
+   };
+
+   int lastUsedId;
+   map<int, MessageContainer> sentMessages;
 };
 
