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;

class Main {
    public static void main(String args[]) throws Exception {
        InetAddress ia = InetAddress.getByName(args[0]);
        int port = Integer.parseInt(args[1]);
        DatagramSocket ds = new DatagramSocket();
        while (true) {
            String s = "asdf";
            byte buffer[] = s.getBytes();
            DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, port);
            ds.send(dp);
        }
    }
}