Commit 231ae273 authored by Simo Vuorinen's avatar Simo Vuorinen
Browse files

mooi

parents
import java.io.*;
import java.net.*;
public class UDPSender {
public static void main(String[] args) throws Exception {
InetAddress targetAddress = InetAddress.getLoopbackAddress();
DatagramSocket socket = new DatagramSocket(); //luo socketin vapaaseen porttiin paikallisessa koneessa
byte[] data = Integer.toString(54545).getBytes();
DatagramPacket packet = new DatagramPacket (data, data.length, targetAddress, 3126); //luo datagrampacketin
socket.send(packet); // lähettää paketin
socket.close(); //sulkee soketin.
} // main
} // UDPLahettaja
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment