public class Main {
public static void main(String[] args) throws IOException {
DatagramChannel datagramChannel = DatagramChannel.open(StandardProtocolFamily.INET);
System.out.println("Server started");
ByteBuffer buffer = Charset.defaultCharset().encode("Hello Junny");
datagramChannel.send(buffer, new InetSocketAddress("localhost", 7788));
System.out.println("Send to server ");
System.out.println("Close to server");
datagramChannel.close();
}
}