[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: getservbyname and getservbyport



Danie Roux <droux@tuks.co.za> wrote:
>If I was to change
>
>sp = getservbyname ("ftp", "tcp");
>
>to 
>
>sp = getservbyport (21, "tcp");
>
>It should work right? Because it isn't. And I need this to work for a boot
>stiffy I'm building.

The port number is given in network byte order. My guess is you'll need:

  sp = getservbyport (htonl (21), "tcp");

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: