Firstly, I'm not talking about logging into a computer via telnet, then running it. I'm talking about a program that acts as a telnet server as well as a console program.
Given that, the program doesn't know whether it is talking to a monitor or a telnet socket. So, it cannot have a line similar to "print STDOUT" or just "print". It has to talk completely in terms of descriptors, like $out.
Now, the way (on Unix) to do this is to bind STDIN and STDOUT so that you can address them as filehandles.
Tangent: a filehandle is really a descriptor. You're sending information to some place. From a syntatical point of view, it doesn't matter whether or not that place is a file, a monitor, or some IP connection to another machine. The OS is what routes the data to the file, monitor, or IP connection.
So, you are now able to (on Unix) address STDIN/STDOUT as descriptors.
The problem with Windows is that you cannot bind STDIN/STDOUT as descriptors. So, the way around is to telnet to yourself, and treat those as descriptors. The information simply routes right back to yourself. :)
In reply to Binding STDIN/STDOUT and why it doesn't work on Windoze
by dragonchild
in thread win32/unix compatible script
by aristAugust
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |