Path: utzoo!mnetor!uunet!husc6!bbn!rochester!cornell!batcomputer!sun.soe.clarkson.edu!nelson From: nelson@sun.soe.clarkson.edu (Russ Nelson) Newsgroups: comp.unix.questions Subject: gethostbyname() Message-ID: <661@sun.soe.clarkson.edu> Date: 30 Mar 88 15:13:08 GMT Sender: nelson@sun.soe.clarkson.edu Reply-To: nelson@sun.soe.clarkson.edu (Russ Nelson) Organization: Clarkson University, Potsdam, NY Lines: 26 I have a problem with the following program. It works when compiled by itself, but when I include it in the phone source (by Jonathan Broome, gotten from Simtel20), it fails. There don't seem to be any stupid #defines in the phone source. I'm running it on a Sun 3 under SunOS 3.4. Or, in lieu of solving THIS problem, does anyone have a multiple user talk program similar to pwrite or phone that operates over tcp/ip? #include #include #include #include main() { struct hostent *hp, *gethostbyname(); char host[32]; struct sockaddr_in locaddr; /* our own host address */ gethostname (host, 32); hp = gethostbyname ("localhost"); printf("\r\nnames: hp->hn: %s hp->h_addr: %s(%d.%d.%d.%d)\r\n", hp->h_name, inet_ntoa(hp->h_addr), hp->h_addr[0], hp->h_addr[1], hp->h_addr[2], hp->h_addr[3]); bcopy ((char *)hp->h_addr, (char *)&locaddr.sin_addr, hp->h_length); printf("\r\nnames: locaddr: %s\r\n", inet_ntoa(locaddr.sin_addr)); }