in reply to Re: Read from a Linux pipe hangs.
in thread Read from a Linux pipe hangs.
Yes they work very well. Now there's the second part of the problem:
I need the read non-blocking of check if there's any
data ready before doing the 'sysread()'.
The complete consumer is a program that reads account
packets from a radius server (this problem has been solved)
and stores the Radius attributes (MAC,IP,User_name) in a
List of Hashes. This list of hashes has to be processed
every 60 seconds.
The consumer only reads from stdin in order to add new
packets to the listofHashes.
Here there's the consumer that works with:
#cat accounts| ./consumer.pl
where accounts has:
MAC1;IP1;USer1
MAC2;IP2;USer2
#consumer.pl
#!/usr/bin/perl -w
my (%account,@accountList,@accountListTemp);
while(1){
my (@lines,$line,@values);
sleep(60);
@lines = <STDIN>;
foreach $line (@lines){
#MAC;IP;User_Name\n
chomp($line);
@values = split ';',$line;
$account{"MAC"} = $values[[0]];
$account{"IP"} = $values[1];
$account{"Name"} = $values[2];
push @accountList, {%account};
}
my $i;
for $i (0 .. $#accountList){
#Process @accountList <-- IMPORTANT !!
}
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Read from a Linux pipe hangs.
by Ultra (Hermit) on Feb 24, 2005 at 07:44 UTC | |
by dmor4477 (Initiate) on Feb 24, 2005 at 12:24 UTC | |
by dmor4477 (Initiate) on Feb 24, 2005 at 12:06 UTC | |
by Ultra (Hermit) on Feb 24, 2005 at 12:24 UTC |