http://www.perlmonks.org?node_id=837270


in reply to poorly documented behaviour of readline() and IO::Select

I had a similar problem years ago. A server was communicating with several clients, but sometimes one line of the communication got lost somewhere. The sleep solution solved the problem, but even then I was not 100% sure the error did not occur rarely, time to time.

Replies are listed 'Best First'.
Re^2: poorly documented behaviour of readline() and IO::Select
by vsespb (Chaplain) on Apr 28, 2010 at 11:04 UTC
    sleep here is just for example. correct solution would be read with sysread/syswrite and detect newline somehow. or develop protocol which not depends on delimiter for messages.
Re^2: poorly documented behaviour of readline() and IO::Select
by Anonymous Monk on Apr 28, 2010 at 20:59 UTC
    Also! if you use eof or eof() together with sysread sysread does not work! (line gets buffered to read it by readline()) !