Because you need to put the port number in network format. Replace
your query line with:
if ((serv = getservbyport(htons(23), "tcp")) == NULL) {
No, it doesn't make it clear in the man page!
Regards,
- Karl Keyte -------------------+-------------------------------------
European Space Agency | Private: Erbacher Strasse 6
Robert-Bosch Strasse 5 | D-64283 Darmstadt, Germany
64293 Darmstadt, Germany | Tel: +(49) 6151 22738
Tel: +(49) 6151 902041 | Fax: +(49) 6151 151319
Fax: +(49) 6151 903414 | Mobile: +(49) 172 6723741
e-Mail: kkeyte@esoc.esa.de | e-Mail: karl@koft.rhein-main.de
--------------------------------+-------------------------------------