HOw can i send and receive images over the socket in java?
47pirates
9
Junior Poster in Training
Recommended Answers
Jump to PostCreate ObjectOutputStream / ObjectInputStream on the socket's streams and use writeObject / readObject to transfer an Image object
Jump to PostNo, but I'll help you learn how to do it yourself.
First read the introduction to the API docs for ObjectOutputStream and ObjectInputStream. You don't need to worry about any of the advanced bits, just the most basic simple example. You will use your Socket's output and input streams …
Jump to PostYou can't mix different stream types over the same socket, but with Object streams you can send/receive pretty much anything you like, including Strings, so that will work for your text
ps: I don't know what format your images are in, but convert them to ImageIcon for sending over …
Jump to PostNo. If you code correctly they are absolutely NOT corrupted. Object I/O Streams would be pretty useless if they corrupted anything as fundamental as a String. Post the relevant bits of your code
Jump to PostIt's hopeless trying to debug your code when you only supply tiny fragments of it. Plus you contradict yourself "still i getting nothing except the garbage value ... " or "but fine with above method".
And you still haven't posted the "garbage values" that I asked for twice.This …
All 23 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
47pirates
9
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
NormR1
commented:
2 Stars for extra effort on this one
+13
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.