Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: (Seemingly) Broken interactions between Net::Server and IO::Pipe?

by tcf03 (Deacon)
on Mar 08, 2006 at 07:25 UTC ( #535112=note: print w/replies, xml ) Need Help??


in reply to Re^2: (Seemingly) Broken interactions between Net::Server and IO::Pipe?
in thread (Seemingly) Broken interactions between Net::Server and IO::Pipe?

I have never used IO::Pipe before, but from the docs it looks like you need to do a
while(<$pipe>) { read from pipe... }
when I run it it cats out the file fine, Id probably replace IO::Pipe with a routine that reads the file one line at a time. At least from what Ive read, that seems to be the desired effect.

UPDATE
BTW, when running this code on Cygwin, I get the following:
ted@skywalkerii ~ $ perl client.pl 2006/03/08-02:31:02 CONNECT TCP Peer: "127.0.0.1:1245" Local: "127.0.0 +.1:8097" Use of uninitialized value in concatenation (.) or string at server.pl + line 23. Got: >Line = < #!/usr/bin/perl -w # client use strict; use IO::Socket::INET; my $sock = IO::Socket::INET->new(PeerHost => 'localhost', PeerPort => 8097, Proto => 'tcp', ); die "Unable to connect" unless $sock->connected(); while (my $receive = <$sock>) { print "Got: >$receive<\n"; }
after copying client.pl to /home/ted/foo/client

Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Replies are listed 'Best First'.
Re^4: (Seemingly) Broken interactions between Net::Server and IO::Pipe?
by bmcatt (Friar) on Mar 08, 2006 at 16:04 UTC
    You're still missing the point. :-)

    The 'cat' output is appearing on the stdout/stderr *of the server*, not in the client. The fact that the "Got:" is showing en empty string (well, just a newline, actually) indicates that nothing's getting from the server to the client. Instead, the Feeder object is failing (effectively) to do anything.

    By the way, I'm using 'cat' here as an example. The real application is running a much more complex command that's producing real output.

    As for reading from <$pipe>, that's exactly what it's trying to do. It's just stored $pipe inside $self and needs to extract it in order to read from it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://535112]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-05-21 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?