How to send images through sockets in java?
问题 I am writing a client-server program and I want that to send an image. The code is the following: //RECEIVER while(true){ try{ socket = server.accept(); out = new ObjectOutputStream(socket.getOutputStream()); out.flush(); in = new ObjectInputStream(socket.getInputStream()); System.out.println("Connected to "+PORTA+"."); while(!socket.isClosed()){ System.out.println("\nPrint the action"); azione = reader.readLine(); if(azione.equals("screenshot")){ out.writeObject("screenshot"); out.flush();