• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read N Decode HTTP Response From Socket?

 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings everyone!



I'm still trying to get know about this topic. he3.
for some reason, yes, I need more feedback for it.



Okay, If I'm not mistaken
I already create a Client socket connected to a server (by domain name)
and then, i got the respond from the server.

To be precise, I want to get the content of it.
And I do passing em, the InputStream into BufferedReader,

but, Once I want to read upon the content.
It seems first written in some Text based, but at the next part
it seems something understand-able

take a look at this.




Is there anyone have ever decode this HTTP Response?
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4328
238
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The content-type header of that response states that the body is a GIF image. You are seeing that weird characters as you are reading the image content through a text-based console.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah!

Yes... sometimes I got it GIF sometimes not also.
It depend upon the respond I received from the actual server.

But still can't get The response as readable. Seems weird.
 
Paul Clapham
Sheriff
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course a GIF image isn't "readable", if you meant you expected to get text from it. Nothing weird about that at all.

As Devaka said, the response includes a content-type header. You should look at that, because it tells you what kind of data to expect. Don't expect to get text if the content-type header tells you that the data is an image.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya problems solved!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic