develooper Front page | perl.vmsperl | Postings from May 2002

more trouble with gethostby*() in DECC/Multinet

Thread Next
From:
PPrymmer
Date:
May 15, 2002 15:14
Subject:
more trouble with gethostby*() in DECC/Multinet
Message ID:
OF012BFEAC.BEC46CC1-ON85256BBA.0077DF7C@55.25.11
I've narrowed down a portion of the trouble
that I have seen with some of the gethostby*()
routines to: netdb.h.  It seems that with the following test
program:

#ifdef SOCKADDR_LEN
# define _SOCKADDR_LEN
#endif
#include  <errno.h>
#ifdef MULTINET_SOCKETS
/* must link against MULTINET:MULTINET_SOCKET_LIBRARY.EXE/SHARE */
# include  "multinet_root:[multinet.include]netdb.h"
#else
# include  <netdb.h>  /* the Compaq C one (UCX) */
#endif
#include <stdio.h>

extern int sys_nerr;
extern int h_errno;

int main() {
    struct hostent *h;
    printf( "%d\n", __CRTL_VER );
    h = gethostbyname( "localhost" );
    if ( h != NULL ) {
        printf( "%s\n", h->h_name );
        printf( "%d\n", h->h_addrtype );
        printf( "%d\n", h->h_length );
#ifdef MULTINET_SOCKETS
        printf( "%s\n", h->h_cputype );
        printf( "%s\n", h->h_opsys );
#endif
    }
    else {
        printf( "h is null\n" );
        herror( "h " );
    }
    return(0);
}

I obtain the following results with
Compaq C V6.5-001 on OpenVMS Alpha V7.3
Process Software MultiNet V4.3 Rev A-X:

$ cc try
$ link try
$ run try
70210022
localhost
2
4

$ cc/define=(SOCKADDR_LEN) try
$ link try
$ run try
70210022
h is null
h : Error 0

$ cc/define=(SOCKADDR_LEN,MULTINET_SOCKETS) try
$ link try
$ run try
70210022
localhost
2
4
(null)
(null)

And just for completeness' sake:

$ cc/define=(MULTINET_SOCKETS) try
$ link try
$ run try
70210022
localhost
2
4
(null)
(null)

It seems that turning on _SOCKADDR_LEN will turn on the 4.4 BSD
version of gethostbyname(), but that the BSD 4.3 based Multinet
4.3 does not honor gethostbyname() calls using 4.4 semantics.

Still no progress on the gethostbyaddr() problem yet...
I just thought these things were interesting (I was able to build
perl with _SOCKADDR_LEN #defined, and Multinet's
netdb.h included and linked against - to little avail).

Peter Prymmer



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About