Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: How to create DatagramPacket from byte array

Java: How to create DatagramPacket from byte array

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
class Ex_Datagramme
  public static void main(String args[]) throws Exception
    InetAddress IP = InetAddress.getByName("");
    int port = 655;
    // Create a datagram socket
    DatagramSocket ds = new DatagramSocket();
    while (true)
     // Create a message and send it as a datagram
      String str = "welcom to tubedir.com";
      byte buff[] = str.getBytes();
      DatagramPacket dp = new DatagramPacket(buff, buff.length, IP, port);

Users who found this page were searching for:

  • jbutton functions samples
  • array string to datagram
  • how to build array of bytes in java
  • perl random value from array
  • python bind
  • java print underline
  • check if an element exists in a dictionary python
  • python if while key press
  • use of comma operator in for loop
  • building a byte array packet java

No comments yet.

Leave a Comment