Android Open Source - anyshoot testudpclient






From Project

Back to project page anyshoot.

License

The source code is released under:

MIT License

If you think the Android project anyshoot listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.DatagramSocket;
//from  w  w  w.ja v a2 s.c o m
class HelloWorldApp {
  public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    try {
      String udpMsg = "hahaha";
      DatagramSocket ds = new DatagramSocket();
      InetAddress serverAddr = InetAddress.getByName("192.168.2.63");
      DatagramPacket dp;
      dp = new DatagramPacket(udpMsg.getBytes(), udpMsg.length(), serverAddr, 5000);
      ds.send(dp);

    } catch (Exception e) {

    }


  }}




Java Source Code List

com.example.anyshoot.MainActivity.java
.testudpclient.java