I Made it work!
So why didnt it work the first time : because I kept opening and closing the output connection instead of keeping it open.
Here is what I did :
given($self->{output}->{$key}->{type}){ when('named_pipe'){ open my $handle ,'>',$self->{output}->{$key}->{name} o +r croak "could not open output handle"; print $handle $input; close $handle; } when('unix_socket'){ my $server = $self->{output}->{$key}->{fh}; if(!exists $self->{output}->{$key}->{socket}){ $self->{output}->{$key}->{socket}= $server->accept +() or croak "$!"; } my $socket = $self->{output}->{$key}->{socket}; print $socket $input; } when('network_socket'){ my $server = $self->{output}->{$key}->{fh}; if(!exists $self->{output}->{$key}->{socket}){ $self->{output}->{$key}->{socket} = $server->accep +t() or croak "$!"; } print "printing to output"; my $socket = $self->{output}->{$key}->{socket}; print $socket $input; } }
Since this code runs inside the read loop for each input it does not need to close and reopen sockets :D
In reply to Re: Inet socket to inet socket communication
by QuillMeantTen
in thread Inet socket to inet socket communication
by QuillMeantTen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |