随笔分类 -  网络编程

摘要:UDPServer: public static void main(String[] args) throws Exception { //1、创建数据报套接字,开放端口 DatagramSocket socket = new DatagramSocket(8888); //2、接收数据包 //用 阅读全文
posted @ 2020-12-26 11:05 Java小白的搬砖路 阅读(96) 评论(0) 推荐(0) 编辑
摘要:TCP服务器端: public static void main(String[] ars) throws Exception { //1、创建服务 ServerSocket ss = new ServerSocket(8888); //2、监听客户端连接 Socket socket = ss.ac 阅读全文
posted @ 2020-12-26 10:48 Java小白的搬砖路 阅读(133) 评论(0) 推荐(0) 编辑
摘要:public static void main(String[] args) throws Exception { /** * 第一种: * demo.jpg是要生成的文件名称 * FileUtils.copyURLToFile(new URL("https://pic.liesio.com/202 阅读全文
posted @ 2020-12-26 10:26 Java小白的搬砖路 阅读(114) 评论(0) 推荐(0) 编辑
摘要:public static void main(String[] args) { InetSocketAddress localhost = new InetSocketAddress("localhost", 8080); System.out.println(localhost.getAddre 阅读全文
posted @ 2020-12-26 10:06 Java小白的搬砖路 阅读(125) 评论(0) 推荐(0) 编辑
摘要:import java.net.InetAddress; import java.net.UnknownHostException; public class Demo01_初识IP { public static void main(String[] args) throws UnknownHos 阅读全文
posted @ 2020-12-26 10:04 Java小白的搬砖路 阅读(183) 评论(0) 推荐(0) 编辑

喜欢请打赏

扫描二维码打赏

支付宝打赏

点击右上角即可分享
微信分享提示