package Inter; import java.io.IOException; import java.net.*; public class InetAddressDemo { public static void main(String[] args) throws IOException { //创建发送socket对象 DatagramSocket ds = new DatagramSocket(); byte[] bys = "哈哈哈".getBytes(); DatagramPacket dp = new DatagramPacket(bys,bys.length, InetAddress.getByName("192.168.0.100"),10080); ds.send(dp); ds.close(); } }