in reply to Reading from more than one socket at once
Overall, good stuff. But I think you better doublecheck
that "Perl will read a few bytes ahead to improve
performance" claim. I don't recall coming across that
anywhere else before. In particular, I've used
print and <> with sockets before
with no problems. The key is to not mix them with
sysread and syswrite.
Also, I think IO::Socket and IO::Select deserve more space. After becoming comfortable with them, I far prefer them over the raw Perl stuff, which looks more like C than Perl. There's a good example of both IO::Socket and IO::Select at the end of perldoc IO::Select. Of course, it should be noted that the major limitation of IO::Select is that it doesn't allow you to wait for reading, writing, and exceptions simultaneously. You have to pick one. But, for the example you show, that's not a limitation.
Finally, one minor thing: "get all the data it wants before continue" should be "...continuing".
But, overall, pretty good stuff. Have a Scooby snack on me.
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: Reading from more than one socket at once
by ahunter (Monk) on Jul 05, 2000 at 01:59 UTC |
In Section
Tutorials