Re: getservbyport (fwd)

Michael Riepe (riepe@ifwsn4.ifw.uni-hannover.de)
Wed, 15 May 1996 04:23:02 +0200


From: Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
[...]
> > Use:
> >
> > if ((serv = getservbyport(htons(23), "tcp")) == NULL) {
> ^^^^^^^^^
>
> this parameter is not "short", it's an int ! time to the RTfineManual...

The value passed to getservbyport is compared with another integer
(s_port in struct servent), which ist set to `ntohs(something)'.
In case of telnet, this is ntohs(23) == 0x1700. The value of
htonl(23) is 0x17000000 which is *wrong*.

Michael.

-- 
 Michael "Tired" Riepe <riepe@ifwsn4.ifw.uni-hannover.de>
 "Beware the storm that gathers here!" (The Prophet's Song)