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


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

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.