I'm using Java DatagramSocket class to send a UDP data gram to an endpoint. The datagram must arrive at the endpoint in 60ms intervals.
I'm finding that DatagramSocket.Send can often take > 1 ms (close to 2) to package and send packets no greater than 56 bytes. This causes my packets to be delivered at 62 ms intervals, rather than 60ms intervals.
This is on a windows vista machine. Here is how I'm measuring the time:
DatagramPacket d = new DatagramPacket(out, out.length, address, port);
long nanoTime = System.nanoTime();
socket.send(d);
long diff = System.nanoTime() - nanoTime;
System.out.println( out.length + " in " + diff + "ms." );
Does any one have tips or tricks to speed this process?