Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit


» HP STK home
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
Content starts here

non-critical impact:

getipnodebyaddr - not documented; use getnameinfo (NcWn14)

NW Impacts

Problem description

The getipnodebyaddr function, although available, is not documented on HP-UX.

This API may not be supported in future release of HPUX.

The getipnodebyaddr function is used to get a node name and service name for an address. This routine is deprecated on Tru64 UNIX and is not documented on HP-UX.


C/C++ Functionsgetipnodebyaddr    

Old behavior

The following example shows how to use the getipnodebyaddr routine:

int  err;
struct hostent   *hp = NULL;
struct in_addr   *in;
const char       *name = NULL;
if (( hp = getipnodebyaddr( (char *)in, sizeof(struct in_addr),
                 AF_INET, &err)) != NULL) {
  name = hp->h_name;

See also

Solution description

Although the getipnodebyaddr function is available on HP-UX, it might be safer to use the getnameinfo to achieve similar results.

Replace calls to the getipnodebyaddr function with the getnameinfo function.

The getnameinfo function does not behave exactly the same as the getipnodebyaddr function. Review your code and applicable manpages for more information.

New behavior

The following example shows how to use the getnameinfo function:

const char      *name = NULL;
struct sockaddr_in   sinaddr;
char                 tmp_buf[MAXHOSTNAMELEN];
if ( getnameinfo( (struct sockaddr*)&sinaddr, sizeof(struct sockaddr_in),
                 tmp_buf, sizeof(tmp_buf), NULL, 0, NI_NAMEREQD) == 0 ) {
   name = tmp_buf;

See also

Problem summary

classifications source types OS release severity type
NW C, C++ any HP-UX 11i version non-critical warning
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.