Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

\r\n\r\n gets appended to a message sent via socket

 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sending message over a socket from the server to the client. At the client, I find that \r\n\r\n is appended at the end of the message. What is the reason for this?
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you sending the data? Please TellTheDetails.
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:How are you sending the data? Please TellTheDetails.


Sorry for that. Here are the details.

Some code snippets of what I am trying to do:


I reduced the problem somewhat by not using PrettyFormat for XMLOutputter, resulting in only \r\n being suffixed instead of \r\n\r\n, but still the problem is very much there.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is in the JDOM XMLOutputter, not in the (Buffered)OutputStream or the Socket. What happens if you print the same document to a text file? Does it also end with two enters?
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:I think the problem is in the JDOM XMLOutputter, not in the (Buffered)OutputStream or the Socket. What happens if you print the same document to a text file? Does it also end with two enters?

Yes indeed that was the case. I prevented XMLOutputter from adding new lines and it worked fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic