http://qs321.pair.com?node_id=1173890


in reply to Re^12: sysread/syswrite wrappers
in thread sysread/syswrite wrappers

select returns right filehandle again, and.. read returns EOF. So whole the time select was triggered by eof event (EOF is "can_read" too).

In other words. IT WORKS!

last select is not finished. means process stuck on it.

You added a sleep to the client. Ergo: you created the exact scenario I warned you about in "And if your messages are not some exact multiple of 4K, the last line of every 4k block will be a partial message, and your wrapper will therefore block until the next 4k block has been filled and passed through, before that message will be completed.".

The problem here is that you've latched onto something completely irrelevant, to distract from the fact that your OP code makes no sense.

I was never suggesting that you should use <readline> & print; only that your code was exactly as vulnerable to the same issue -- an incomplete message, perpetual block -- as they are.

Ie. If you added that sleep in the same place in the client code, and ran it against your OP sysread() wrapper, it blocks in exactly the same way!

Your OP wrappers are useless, because they are vulnerable in exactly the same way as readline.

And that's the point.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^14: sysread/syswrite wrappers
by vsespb (Chaplain) on Oct 13, 2016 at 04:56 UTC
    In other words. IT WORKS!
    No. It does not. It hangs. Unless you reconnect every messages (close socket after every message and make new connections for new messages).
    that your code was exactly as vulnerable to the same issue -- an incomplete message, perpetual block -- as they are.
    Ie. If you added that sleep in the same place in the client code, and ran it against your OP sysread() wrapper, it blocks in exactly the same way!
    No. Your code hanged without printing "This is the last line". Mine would block in the same select, waiting new data (which will not come), but after printing "This is the last line".
    Ie. If you added that sleep in the same place in the client code, and ran it against your OP sysread() wrapper, it blocks in exactly the same way!
    No, but my code will block in case incomplete message (which will never happen, unless client is buggy), and your code hangs even in the middle of complete message: client sent complete message, but code read only half of it.
      It works. Until *YOU* fuck it up.

      Thick as two short planks.

        You were not right from the beggining, in all your statements. And you can't admit your mistakes. Discussion is useless.