- import java.net.*;
- import java.io.*;
- class UdpSend2
- {
- public static void main(String[] args) throws Exception
- {
- DatagramSocket ds = new DatagramSocket();
- BufferedReader bufr =
- new BufferedReader(new InputStreamReader(System.in));
- String line = null;
- while((line=bufr.readLine())!=null)
- {
- if("886".equals(line)) //886是什么意识啊
- break;
- byte[] buf = line.getBytes();
- DatagramPacket dp =
- new DatagramPacket(buf,buf.length,InetAddress.getByName("192.168.1.255"),10001);
- ds.send(dp);
- }
- ds.close();
- }
- }
复制代码 |
|