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

class changes

parent 700704bd
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ public class UdpSender ...@@ -17,7 +17,7 @@ public class UdpSender
public static final int SENDING_PORT = 1414; public static final int SENDING_PORT = 1414;
public static final int RECEIVING_PORT = 1415; public static final int RECEIVING_PORT = 1415;
public static final String DESINATION_HOST = "localhost"; public static final String DESTINATION_HOST = "localhost";
public static void main(String[] args) public static void main(String[] args)
{ {
...@@ -32,14 +32,15 @@ public class UdpSender ...@@ -32,14 +32,15 @@ public class UdpSender
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos); DataOutputStream dos = new DataOutputStream(baos);
dos.writeFloat(17.0f); // alternatives: writeFloat(17.0f); writeInt(17); // alternatives: writeFloat(17.0f); writeInt(17); writeUTF("\"hello MV3500 no really\"");
dos.writeFloat(17.0f);
dos.writeFloat(23.0f); dos.writeFloat(23.0f);
byte[] buffer = baos.toByteArray(); byte[] buffer = baos.toByteArray();
// Put together a packet to send // Put together a packet to send
// ID of the host we are sending to // ID of the host we are sending to
InetAddress destinationAddress = InetAddress.getByName(DESINATION_HOST); InetAddress destinationAddress = InetAddress.getByName(DESTINATION_HOST);
DatagramPacket packet = new DatagramPacket(buffer, buffer.length, destinationAddress, RECEIVING_PORT ); DatagramPacket packet = new DatagramPacket(buffer, buffer.length, destinationAddress, RECEIVING_PORT );
......
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