MarkDown学习
程序员文章站
2022-03-23 22:53:25
MarkDown学习1.1标题1.2字体HelloWorld!HelloWorld!HelloWorld!HelloWorld!1.3引用引用1.4分割线1.5图片[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kDfLPjML-1605105864536)(https://www.baidu.com/cache/icon/favicon.svg)]1.6超链接点击跳转到我的博客1.7列表ABCABC表格名字...
MarkDown学习
1.1标题
1.2字体
HelloWorld!
HelloWorld!
HelloWorld!
HelloWorld!
1.3引用
引用
1.4分割线
1.5图片
1.6超链接
1.7列表
- A
- B
- C
- A
- B
- C
表格
名字 | 性别 | 生日 |
---|---|---|
张三 | 男 | 1997.1.1 |
代码
package chat;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
public class TalkReceive implements Runnable{
DatagramSocket socket = null;
DatagramPacket packet = null;
private int port;
private String msg;
public TalkReceive(int port, String msg) {
this.port = port;
this.msg = msg;
try {
socket = new DatagramSocket(this.port);
} catch (SocketException e) {
e.printStackTrace();
}
}
@Override
public void run() {
//准备容器接受数据
try {
while(true){
byte[] container = new byte[1024];
packet = new DatagramPacket(container,0,container.length);
socket.receive(packet);
//处理数据
byte[] data = packet.getData();
String receiveData = new String(data,0,data.length);
System.out.println(msg + ":" + receiveData);
//断开连接
if(receiveData.equals("bye")){
break;
}
}
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Hello World
本文地址:https://blog.csdn.net/Manjuas/article/details/109633234
下一篇: java8 时间操作