Index: common/Common.cpp
===================================================================
--- common/Common.cpp	(revision 68d94de7bbe815d1c0be9b36199a2411f78823b3)
+++ common/Common.cpp	(revision 8554263f37bc4e15ded77204278d53ae15d0375a)
@@ -13,4 +13,6 @@
 #include <cmath>
 #include <ctime>
+#include <cstdlib>
+#include <cstdio>
 
 using namespace std;
@@ -30,4 +32,11 @@
 
    return position;
+}
+
+// This might not be cross-platform. Verify that this works correctly or fix it.
+void error(const char *msg)
+{
+    perror(msg);
+    exit(0);
 }
 
Index: common/Common.h
===================================================================
--- common/Common.h	(revision 68d94de7bbe815d1c0be9b36199a2411f78823b3)
+++ common/Common.h	(revision 8554263f37bc4e15ded77204278d53ae15d0375a)
@@ -20,4 +20,5 @@
 };
 
+void error(const char *msg);
 void set_nonblock(int sock);
 unsigned long long getCurrentMillis();
Index: common/MessageProcessor.cpp
===================================================================
--- common/MessageProcessor.cpp	(revision 68d94de7bbe815d1c0be9b36199a2411f78823b3)
+++ common/MessageProcessor.cpp	(revision 8554263f37bc4e15ded77204278d53ae15d0375a)
@@ -40,5 +40,8 @@
    int ret =  sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
 
-   return ret;
+   if (ret < 0)
+      error("sendMessage");
+   else
+      return ret;
 }
 
