• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTP request syntax question (overly simple)  RSS feed

 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All.

Very new to Java, and learning from various books all at once, wondering if somebody could help me with one line of this code snippet, which is an HTTP request:


My question is: What purpose does the last line of code serve?

Thanks for any help in advance.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the HTTP protocol defines it that way - after the header (and before the body) two newlines are needed. This indicates where the header ends.

Note that this code will only work on Windows platforms, where the "ln" part of "println" translates to a carriage return character followed by a newline character. The details can be found in this article: Don't println to a Socket
[ December 05, 2006: Message edited by: Ulf Dittmer ]
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf--
Thanks so much for your timely response.

Upon further research, you're absolutely right, of course. Thanks again, and thanks for the link!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!