Package

Source Code of Senda

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.io.IOException;
import java.net.InetAddress;

public class Senda {

    public static void main(String[] argv) {
 
  //String message = "0x01" ;
  byte[] to_send = new byte[1];// message.getBytes() ;  //créer un tableau to_send de type byte
  to_send[0] = 0x01//remplit la 1ere case du tableau avec l'argument 0x01
  try {
      DatagramPacket outPacket =
    new DatagramPacket(to_send, to_send.length,InetAddress.getByName("192.168.1.11"),1234);//exemple après voir par rapport au drone pour l'ip et le port //créer un datagramme contenant to-send
      DatagramSocket socket = new DatagramSocket() ;
      socket.send(outPacket) ;
  } catch (IOException e) {
      System.out.println("Oups!!! un problème est survenu, passage en mode stablisation") ;
  }

    }


}
TOP

Related Classes of Senda

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.