S
Sébastien Cottalorda
Hi all,
Several programs need to write in a pipe (created with "mknod /tmp/pipe.tub
p").
My problem is the following :
If no program read the other side of the pipe, all writing operations are
blocked.
I don't care if I lost information, but I'd like programs to try to write to
the pipe and return doing what they are programmed to.
Here is my program:
#====================================================================
#!/usr/bin/perl -w
use strict;
use Fcntl;
my $named_pipe='/tmp/pipe.tub';
unless (-e $named_pipe){
die "No way" if (system("/bin/mknod $named_pipe p"));
}
unless (sysopen(PIPE, $named_pipe, O_WRONLY|O_NONBLOCK)){
die "Can\'t open $named_pipe : $!";
}
while(1){
print "Trying to write in the pipe ...";
print PIPE "Heelo World\n";
print "Done\n";
sleep 3;
}
close(PIPE);
exit;
#=====================================================================
When I run that program, I get:
Can`t open pipe: Device not configured at line 10
What's wrong ????
My OS: Mandrake 7.1 (kernel 2.2.15-4mdk)
My Perl: perl 5.6.0
Thanks in advance for any kind of help.
Sébastien
Several programs need to write in a pipe (created with "mknod /tmp/pipe.tub
p").
My problem is the following :
If no program read the other side of the pipe, all writing operations are
blocked.
I don't care if I lost information, but I'd like programs to try to write to
the pipe and return doing what they are programmed to.
Here is my program:
#====================================================================
#!/usr/bin/perl -w
use strict;
use Fcntl;
my $named_pipe='/tmp/pipe.tub';
unless (-e $named_pipe){
die "No way" if (system("/bin/mknod $named_pipe p"));
}
unless (sysopen(PIPE, $named_pipe, O_WRONLY|O_NONBLOCK)){
die "Can\'t open $named_pipe : $!";
}
while(1){
print "Trying to write in the pipe ...";
print PIPE "Heelo World\n";
print "Done\n";
sleep 3;
}
close(PIPE);
exit;
#=====================================================================
When I run that program, I get:
Can`t open pipe: Device not configured at line 10
What's wrong ????
My OS: Mandrake 7.1 (kernel 2.2.15-4mdk)
My Perl: perl 5.6.0
Thanks in advance for any kind of help.
Sébastien