@Override
		public void run() 
		{
			try
			{
				boolean isFirst = true;
				while (true)
				{
					byte[] buffer = new byte[32];
					DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
					socket.receive(packet);
					buffer = packet.getData();
					
					byte[] msg = new byte[packet.getLength()];
					System.arraycopy( buffer, 0, msg, 0, msg.length );
					
					CommandMsg.Command lCommandMsg = null;
					
					try
					{
						lCommandMsg = CommandMsg.Command.parseFrom(msg);
					}
					catch (InvalidProtocolBufferException e)
					{
						continue;
					}					
					
					long lCurrentTime = System.currentTimeMillis();
					long lSentTime = lCommandMsg.getTimestamp();
					int lMsgId = lCommandMsg.getMsgId();
					
					if (lMsgId == 0)
					{
						continue;
					}
					
					long lRtt = lCurrentTime - lSentTime;
					
					if (isFirst)
					{
						minLatency = lRtt;
						maxLatency = lRtt;
						isFirst = false;
					}
					else
					{
						if (lRtt < minLatency)
						{
							minLatency = lRtt;
						}
						if (lRtt > maxLatency)
						{
							maxLatency = lRtt;
						}
					}
					
					averageLatency += lRtt;
					
					log[logIndex++] = "Id: " + lMsgId + " RTT: " + lRtt;
				}
			}
			catch(IOException e)
			{
				if (logIndex > 0)
				{
					for (int i = 0; i < logIndex; i++)
					{
						System.out.println(log[i]);
					}
					
					System.out.println("Min: " + minLatency);
					System.out.println("Max: " + maxLatency);
					System.out.println("Average: " + averageLatency / logIndex);
				}			
			}	
		}