one way simplistic way to try the sysread() approach would be go with something like
my $message;
my $bytes=1; while ($bytes) { $bytes = sysread(SOCK,$buf,4096); $message .= $buf; # or try say # last if eof(SOCK); }
In my admittedly limited experience with network programming, I've never seen anything like this half-way approach pay off. Either A it was simple enough you could use the easy tools, or B you had to get serious and do a little work. That's just my opinion though and I could be very wrong.
Assuming of course that one is just going to read the socket dry, and the server side will close it off so that the eof() event will be 'hearable'.
The moral: Network programming CAN be tricky. Take it step by step and keep it as simple as possible for what you need.
The alternative of course is to go with some sort of 'header/payload' approach, in which the header will call out how many bytes are to be read off the socket as 'payload'. Or build out a 'non-line oriented' protocol that offers a specific EOM ( end of message ) indicator, or ....
There really are a lot of choices. Again telling us your long term goal may help us help you. For example, if you're writing a web server, we should probably steer the discussion over to forking... ;)
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]