$ exec 3<> /dev/tcp/127.0.0.1/54321
./-ksh: /dev/tcp/127.0.0.1/54321: cannot create [Connection refused]
I came across an example on the web that does indeed work on my
machines (SunOS and Linux). It communicates with a specific machine
somewhere out there in the world.
host=rs.internic.net
port=43
exec 3<> /dev/tcp/$host/$port
set kornshell.com
print -u3 -f "%s\r\n" "$@"
cat <&3
However, when I use an IP address or hostname of one of my machines in
the above "exec ...", it always fails. For example, for for my
machine's "daytime" port (13) or my machine's dynamically-allocated
port "54321":
$ exec 3<> /dev/tcp/127.0.0.1/13
./-ksh: /dev/tcp/127.0.0.1/13: cannot create [Connection refused]
What I'm I missing?
Thanks,
Dan
Yes indeed, the builtin networking of ksh88 and newer
would have been a wonderful facility, were it to have been
a _reliable_ feature, insofar as most kornshells I have used
have this facility unusable for one reason or another.
Instead of a long-winded discourse, I'll redirect you to another
thread that discusses this with more technical detail:
Keep in mind that your problem could still be something not
related to ksh(1), but to another networking issue -- it's usually
an issue with dynamically-allocated ports, except that you
indicate that the well-known port 13 doesn't work.... With only
the above information, there is no way to determinately tell.
Start jiggling connectors? ;)
Try some other scripts:
"httpd.bash"
http://home.eol.ca/~parkw/httpd.sh
"sh-httpd.ash"
http://sourceforge.net/projects/sh-httpd/
(Try host: http://www.pugo.org:8080/)
"httpd.ksh"
http://shelldorado.com/newsletter/issues/1999-2-Sep.html
=Brian