Skip to content
Snippets Groups Projects
Commit ffdcf30d authored by Brutzman, Don's avatar Brutzman, Don
Browse files

source cleanup

parent 8c1461e2
No related branches found
No related tags found
No related merge requests found
......@@ -43,10 +43,9 @@ public class UdpReceiver
System.out.println("first value: " + first + " second value: " + second);
}
}
catch(Exception e)
catch(IOException e)
{
System.out.println(e);
}
}
}
package udpsender;
import java.io.*;
......@@ -34,7 +33,7 @@ public class UdpSender
DataOutputStream dos = new DataOutputStream(baos);
// alternatives: writeFloat(17.0f); writeInt(17); writeUTF("\"hello MV3500 no really\"");
dos.writeFloat(17.0f);
dos.writeFloat(23.0f);
dos.writeFloat(24.0f);
byte[] buffer = baos.toByteArray();
// Put together a packet to send
......@@ -50,14 +49,14 @@ public class UdpSender
// that you haven't received a duplicate UDP packet, out of
// order packet, or dropped packet?
for(int idx = 0; idx < 100; idx++) // avoid infinite send loops in code, can be hard to kill!
for(int index = 1; index <= 100; index++) // avoid infinite send loops in code, can be hard to kill!
{
udpSocket.send(packet);
Thread.sleep(1000); // Send 100, one per second
System.out.println("Sent packet " + idx + " of 100");
System.out.println("Sent packet " + index + " of 100");
}
}
catch (Exception e)
catch (IOException | InterruptedException e)
{
System.out.println(e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment