@Override
	public ElapsedTimeInterval udpPing(byte[] header, String hostIP, int udpPort, int socketTimeout, int nTrials) {

		DatagramSocket socket;
		try {
			for (int i = 0; i < nTrials; i++) {
				socket = new DatagramSocket();
				socket.setSoTimeout(socketTimeout);
				DatagramPacket packet = new DatagramPacket(header, header.length, new InetSocketAddress(hostIP, udpPort));

				try {
					ElapsedTime.start("PingRaw_UDPTotalDelay");
					socket.send(packet);
					byte[] receiveBuf = new byte[EchoServiceBase.RESPONSE_OKAY_STR.length()];
					DatagramPacket receivePacket = new DatagramPacket(receiveBuf, receiveBuf.length);
					socket.receive(receivePacket);
					if (receivePacket.getLength() != EchoServiceBase.RESPONSE_OKAY_STR.length()){
						ElapsedTime.abort("PingRaw_UDPTotalDelay");
						System.out.println("Bad response: sent "+ header.length + " bytes but got back "+ receivePacket.getLength());
					}
					String rcvdHeader = new String(receiveBuf, 0, 4);
					if (!rcvdHeader.equalsIgnoreCase(EchoServiceBase.RESPONSE_OKAY_STR)){
						ElapsedTime.abort("PingRaw_UDPTotalDelay");
						System.out.println("Bad returned header: got '" + rcvdHeader + "' but wanted '" + EchoServiceBase.RESPONSE_OKAY_STR);
					}
					ElapsedTime.stop("PingRaw_UDPTotalDelay");	
				} catch (SocketTimeoutException e) {
					// This exception is thrown if we wait on receive() longer
					// than the timeout
					ElapsedTime.abort("PingRaw_UDPTotalDelay");
					//System.out.println("UDP socket timeout");
				} catch (IOException e) {
					// TODO Auto-generated catch block
					ElapsedTime.abort("PingRaw_UDPTotalDelay");
					e.printStackTrace();
				} catch (Exception e) {
					// TODO Auto-generated catch block
					ElapsedTime.abort("PingRaw_UDPTotalDelay");
					e.printStackTrace();
				}
				socket.close();
				socket = null;
			}
			
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return ElapsedTime.get("PingRaw_UDPTotalDelay");
	}