
pedrete
New User
Oct 29, 2012, 12:43 PM
Post #1 of 2
(688 views)
|
|
PIPEs and Sockets: not working.. but why???
|
Can't Post
|
|
Hello everybody... Can anyone give me his/her opinion on this, please??? i am trying to use a "|-" Pipe to communicate 2 processes and it works OK when the parent just prints a string to the chlid via PIPE. But when the the parent process tries to print to child via PIPE something it got from a TCP socket, it does not work... :-( This code shows what i am trying to do.... i mark in red the important area ($linea is never printed to "TO") (I omit all the communications code to reduce post size) if ( open(TO,"|-") ) { # Parent while(1){ accept (SOCK, SOCK_SERVER); $linea=<SOCK>; print TO "$linea \n"; close SOCK; } } else { # Child while(1){ $entrada=<STDIN>; print " Received in Child: $entrada "; } } The Child never prints anything! :- if i change the red area and write it like next code (just to test the PIPE), it works!!! so the problem seems to be <SOCK> related???????? :-( please, help!! if ( open(TO,"|-") ) { # Parent while(1){ $linea="HELLO"; print TO "$linea \n"; } } else { # Child while(1){ $entrada=<STDIN>; print " Received in Child: $entrada "; } } Thanks in advance for your help... Pedrete
(This post was edited by pedrete on Oct 29, 2012, 12:44 PM)
|