On Mon, Sep 24, 2012 at 1:40 PM, ajay paswan <lists / ruby-forum.com> wrote:
> Hi I am doing a socket programming, I want to send a string with
> multiple lines, i.e. it contains "\n".
> What I did:
> a="Hi"
> a+="\n"
> a+="there"

That can be simplified to

a = "Hi\nthere"

> if I send 'a' over socket, I get only "Hi",

There are two potential reasons for that:

1. you do not append a trailing newline (e.g. by using #puts on the socket).
2. the reader just reads a single line

> could you suggest me any
> plateform independent solution? Atleast which works for windows and
> ubuntu.

See above.

> I tried replacing "\r\n" for "\n" but its behaving in the same way.
> Interestingly I wrote a small program just to check, but that program is
> working. What is the way people send newline over socket?

Please post the program (or share it via github or a pastebin).

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/