Yes you can send multiple data in a single packet. The packet you are sending in the first argument is an array, of which size you define with the length argument. Offset just defines where you want to start reading the array. In most cases you would keep offset to zero.
ie:
- Code: Select all
byte [] packet = new byte[3];
packet[0] = (byte) 0xf7;
packet[1] = (byte) x;
packet[2] = (byte) y;
sendPacket(packet,0,3);
So when you recieve the package on the reciever, you will access element 1 for x and element 2 for y.