We don't bite newbies here... much | |
PerlMonks |
Re: socket reading...by bikeNomad (Priest) |
on Jul 28, 2001 at 21:09 UTC ( [id://100571]=note: print w/replies, xml ) | Need Help?? |
You could put your socket into non-blocking mode and actually look at the return value from sysread. If your responses over the socket are record-oriented and terminated by a particular character (like, say, "\n") you could set $/ to that character and use the <$sock> form. Otherwise, if you have a length indication at the beginning of each response, read that first and then read exactly the right number of bytes. update: corrected part about blocking if you try to read too many bytes.
In Section
Seekers of Perl Wisdom
|
|