tags:

views:

470

answers:

3

I want to send image object through socket... Don't want to store image in sender or receivers computer...

+1  A: 

So what have you tried ?

This is a tutorial on client/server communication using Java. This reads from stdin, but in your instance you should probably provide an InputStream on your image object.

Brian Agnew
+1  A: 

Use this serialization for an image object to send it through the socket.

Eran Betzalel
+1  A: 

Use this method:

  ImageIO.write(RenderedImage, String, OutputStream)

Use in your situation:

Sender

   BufferedImage image = ....;
   ImageIO.write(image, "PNG", socket.getOutputStream());

Receiver

   BufferedImage image = ImageIO.read(socket.getInputStream());
Martijn Courteaux