diff -r 38d9cc60b14c -r e0a76056a633 project_files/frontlib/socket.c
--- a/project_files/frontlib/socket.c	Wed Nov 21 18:34:45 2012 +0100
+++ b/project_files/frontlib/socket.c	Thu Nov 22 00:56:36 2012 +0400
@@ -84,7 +84,7 @@
 			srand(time(NULL));
 			for(int i=0; !result->sock && i<1000; i++) {
 				// IANA suggests using ports in the range 49152-65535 for things like this
-				result->port = 49152+(rand()%(65535-49152));
+				result->port = 49152+(rand()%(65536-49152));
 				result->sock = listen(result->port);
 			}
 		}