udpsend.java
来自「一个关于服务器和客户端的聊天程序,简单好用,类似」· Java 代码 · 共 23 行
JAVA
23 行
import java.net.*;
public class UdpSend {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) throws Exception
{
// TODO: Add your code here
DatagramSocket ds = new DatagramSocket();
String strInfo = "hello你好";
ds.send(new DatagramPacket("hello你好".getBytes(),"hello你好".getBytes().length,InetAddress.getByName("192.168.1.238"),3000));
ds.close();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?