Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending multiple paragraphs

 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a socket program which sends textual information to a server. But when a user puts in a new paragraph and sends it, it doesnt get sent. Its there a reason why this happens and could be avoided?

Cheers,
Dan
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server may be doing a single readline to get input, or reading until it gets a line with zero length. Do you have access to the server code to see what's going on?

You might have to translate newlines into some escape sequence to send them, but then they probably won't display correctly the next time you look at them.
 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the server is doing a readLine. Would haveing just a read make much difference? Or should I take the route of putting in my own escape characters and parsing the text?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you make the server read lines until some kind of "fence" or end of message signal? The examples I have handy are all HTTP which is a bit more complex, and I can't recall if you can really tell the end of message from the socket stream. I think you can't tell the difference between end of message and a slow network that lets the server get ahead of the incoming data.
 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stan,

Ive changed my code to read in the byte stream and then convert it into a String and that has solved the problem. thanks for the help

Dan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!