Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] argv) throws Exception {

        byte[] outbuf = new byte[1024];
        int port = 1234;
        DatagramSocket socket = new DatagramSocket();
        InetAddress groupAddr = InetAddress.getByName("8.1.2.3");
        DatagramPacket packet = new DatagramPacket(outbuf, outbuf.length, groupAddr, port);
        socket.send(packet);
    }
}