PDA

View Full Version : gawk question


daniel_I_l
18th November 2008, 09:37 PM
I tried to run the gaek program:

BEGIN {
"/inet/tcp/0/localhost/daytime" |& getline
print $0
}

and got the error:
gawk: prog:2: fatal: can't open two way socket `/inet/tcp/0/localhost/daytime' for input/output (No such file or directory)
but when I checked my /etc/services file daytime was listed as a tcp service in socket 13. What could the problem be?
Thanks.

markkuk
18th November 2008, 09:48 PM
/etc/services simply lists the port numbers registered with IANA. You must start a daytime server on your machine to make the command work.

daniel_I_l
18th November 2008, 10:01 PM

How do I start a daytime server? Isn't it supposed to be started at startup?
Thanks.

RupertPupkin
19th November 2008, 04:45 AM
The daytime service is not started manually, it's handled by the xinetd service. You just have to enable it.
In the files /etc/xinetd.d/daytime-dgram and /etc/xinetd.d/daytime-stream change the line that says "disable = yes" to "disable = no".
Then reload the xinetd service: /etc/init.d/xinetd reload

markkuk
19th November 2008, 09:27 AM
How do I start a daytime server? Isn't it supposed to be started at startup?

Daytime is an obsolete protocol that's mostly used in programming examples because its simplicity. It's useless as a time service. There's no reason to start it automatically at boot and it isn't even installed by default.