ViewTerm v1.2 (implémentation du pingback)

This commit is contained in:
SeekDaSky 2017-05-04 12:30:53 +02:00
parent a2ab8d415e
commit 01aeb922c4
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package ViewTerminal; package ViewTerminal;
import java.io.IOException;
import java.net.DatagramPacket; import java.net.DatagramPacket;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
@ -27,8 +28,17 @@ public class PlaneContainer {
public void notifyReceive() throws InvalidFlagException{ public void notifyReceive() throws InvalidFlagException{
DatagramPacket packet = this.socket.synchronousReceive(); DatagramPacket packet = this.socket.synchronousReceive();
ByteBuffer buf = ByteBuffer.allocate(1);
buf.put((byte)16);
DatagramPacket ping = new DatagramPacket(buf.array(),buf.array().length,packet.getAddress(),packet.getPort());
try {
this.socket.send(ping);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ByteBuffer buf = ByteBuffer.wrap(packet.getData()); buf = ByteBuffer.wrap(packet.getData());
byte flag; byte flag;
byte nbrPlane; byte nbrPlane;

Binary file not shown.