Re: OT: getservbyname and getservbyport

2001-09-19 Thread Michael Heldebrant
On Fri, 2001-07-27 at 05:27, Danie Roux 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.

Does quoting the 21 help at all?

--mike



OT: getservbyname and getservbyport

2001-07-27 Thread Danie Roux
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.

-- 
Danie Roux *shuffle* Adore Unix



Re: OT: getservbyname and getservbyport

2001-07-27 Thread Colin Watson
Danie Roux [EMAIL PROTECTED] 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  [EMAIL PROTECTED]