Hello again,
I am trying to write a routine to read all the data from a
socket or filehandle. The reference is passed to the routine
and the read data is returned to the caller. That much is obvious. So far things seem to work ok, but i'd like to be sure this is water tight.
sub Socket_Read {
my $Socket = shift;
my $ibits = '';
my $Read_Data;
vec($ibits,fileno($Socket),1) = 1;
while(select($ibits,undef,undef,0.2)) {
last if(!sysread($Socket,my $Input,8192));
$Read_Data .= $Input;
}
return($Read_Data);
}
Please, if you know a better way to do this i'm all ears.
thank you in advance,
Isaac Close