// udp2.sce
sender = jcompile("UdpSender", ["import java.io.IOException;"
"import java.net.DatagramPacket;"
"import java.net.DatagramSocket;"
"import java.net.InetAddress;"
"import java.net.SocketException;"
"import java.util.logging.Level;"
"import java.util.logging.Logger;"
"/**"
" *"
" * @author Jean Jonethal"
" */"
"public class UdpSender {"
"    static InetAddress inadr;"
"    static DatagramSocket testDgs;"
"    static DatagramPacket dgp;"
"    static final int RX_PORT_NUMBER = 8012;"
"    public static void init() {"
"        try {"
"            inadr = InetAddress.getByName(""localhost"");"
"            testDgs = new DatagramSocket();"
"            byte[] message = new byte[2048];"
"            dgp = new DatagramPacket(message, message.length);"
"            dgp.setPort(RX_PORT_NUMBER);"
"            dgp.setAddress(inadr);"
"        } catch (SocketException ex) {"
"            Logger.getLogger(UdpSender.class.getName()).log(Level.SEVERE, null, ex);"
"        } catch (IOException ex) {"
"            Logger.getLogger(UdpSender.class.getName()).log(Level.SEVERE, null, ex);"
"        }"
"    }"
"    public static void send(String message) {"
"        try {"
"            dgp.setData((message).getBytes());"
"            testDgs.send(dgp);"
"        } catch (IOException ex) {"
"            Logger.getLogger(UdpSender.class.getName()).log(Level.SEVERE, null, ex);"
"        }"
"    }"
"}" ]);

sender.init()
sender.send("Hallo Leute from scilab")

jremove hello hw
