Just another Perl shrine | |
PerlMonks |
IO::Socket:SSL and Net::Server STDOUT redirectionby Zucan (Beadle) |
on Nov 17, 2014 at 15:45 UTC ( [id://1107431]=perlquestion: print w/replies, xml ) | Need Help?? |
Zucan has asked for the wisdom of the Perl Monks concerning the following question:
I have been tinkering around with a forking server in Perl. Since I wanted the ability to shell out and execute commands and have their output sent back over the socket, I took advantage of redirecting STDIN/STDOUT to the socket. This works perfectly if I am not doing SSL. With SSL, it does not work.
Here is an example of me using IO::Socket::INET, which works:
Here is an example of me using IO::Socket::SSL, which does not work: Here is the output of each script when ran:
There are plenty of examples about how to do a forking server with the IO::Socket module with STDIN/STDOUT redirection. As soon as the IO::Socket module is flipped to SSL, the redirection no longer works. The above examples do not do what I really wanted, which is to shell out and execute a command. If I can't get a basic print statement to work with IO redirection, then shelling out won't work either. I looked at other modules too. Net::Server was more useful to me and seemed to work better. Here is an example without using SSL:The above works perfectly. All three echo commands go over the socket. Here is the SSL example: I tried it with both "ssl" and "ssleay" and the results were identical. Surprisingly, I get the output from the Command Pipe, but I don't get output from the other two. The following is the output from the non-ssl and the ssl example scripts from above:
Just to be sure the Command Pipe section wasn't interfering with the other two sections, I did play around with commenting all but one section at a time and the results were the same... the Command Pipe works but the System Command and Exec Command sections do not. I spent the last several days researching this on the Internet, reading up in my books and playing around extensively in code. I now ask for Wisdom from the Perl Monks community. I would like to know why redirection doesn't work at all with IO::Socket::SSL and what am I missing with regards to the system() and exec() calls that prevents redirection working with the Net::Server module. Thank you,Zucan
Back to
Seekers of Perl Wisdom
|
|