进阶day11-网络编程_TCP多线程lambda方式文件上传的实现

This commit is contained in:
2026-03-27 11:09:57 +08:00
parent 580ccafb2a
commit fcd7b9e1b4
3 changed files with 119 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ import java.net.Socket;
public class TcpUploadClientDemo07 {
public static void main(String[] args) throws IOException {
//1.创建字节输入流读取图片的字节数据
FileInputStream fis = new FileInputStream("4.jpg");
FileInputStream fis = new FileInputStream("1.jpg");
//2.创建客户端对象指定服务器的IP和端口
Socket client = new Socket("192.168.22.51", 10002);
OutputStream os = client.getOutputStream();//发送请求数据