模拟服务器和客户端通信时出现的java.net.SocketException: Connection reset

模拟客户端上传,服务器保存下载并返回通知的功能,程序运行成功结束,客户端也收到了服务器的返回信息,但是最后报出java.net.SocketException: Connection reset
,,,请问是什么原因
客户端代码

 public static void main(String[] args) throws IOException {
        //客户端本地字节流读取文件
        FileInputStream fis = new FileInputStream("D:\\111.jpg");
        //客户端使用网络字节输出流,上传文件到服务器
        Socket socket = new Socket("127.0.0.1",8888);
        OutputStream outputStream = socket.getOutputStream();
        int len = 0;
        byte[] bytes = new byte[1024];
        while ((len = fis.read(bytes))!=-1){
            outputStream.write(bytes,0,len);
        }
        socket.shutdownOutput();
        //客户端使用网络字节输入流,读取服务器回弹的信息
        InputStream is = socket.getInputStream();
        while((len = is.read(bytes))!=-1){
            System.out.println(new String(bytes,0,len));
        }
        fis.close();
        socket.close();

    }

服务器代码

public static void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(8888);
        Socket accept = server.accept();
        InputStream is = accept.getInputStream();
        File file = new File("D:\\javagogogo");
        if (!file.exists()){
            file.mkdir();
        }
        FileOutputStream fos = new FileOutputStream(file+"\\pic.jpg");
        int len = 0 ;
        byte[] bytes = new byte[1024];
        while ((len = is.read(bytes))!=-1){
            fos.write(bytes,0,len);
        }

        OutputStream ops = accept.getOutputStream();
        ops.write("上传成功".getBytes());

        fos.close();
        server.close();

    }

https://blog.csdn.net/qq_38339561/article/details/84887663