|Just another Perl shrine|
Re^2: IO::Select - reading multiple linesby nagalenoj (Friar)
|on Jul 14, 2011 at 13:23 UTC||Need Help??|
I've many questions raising now., Let me tell what's in my mind.
So, is it a very worse idea to use <$fh> to read from a socket? Because, it is failing straight away without doing lot of magic(stuffs) in the code.Server side
In the above sample, client is receiving only abc(first message) sent by server. When server quits, can_read is returning and client is receiving the remaining messages, not blocking. Getting messages one after another.
Then, I tried with sysread as suggested here. When using sysread, should I read byte by byte till '\n'? Because, I don't know the size of the message. Is it a good way to read byte by byte, do concatenation and then process the message?(I don't think so.)
Please, explain me some way to write a error free way(pleasant way too) to receive messages in socket.. or let me know what am I doing wrong.Thanks.