Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^13: sysread/syswrite wrappers

by BrowserUk (Pope)
on Oct 12, 2016 at 23:42 UTC ( #1173890=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1173890]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2019-12-11 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?