Return-Path: william@bourbon.usc.edu Delivery-Date: Tue Oct 28 19:47:31 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m9T2lVXD011767 for ; Tue, 28 Oct 2008 19:47:31 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m9T2wgT6006661 for ; Tue, 28 Oct 2008 19:58:42 -0700 Message-Id: <200810290258.m9T2wgT6006661@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS551 final1 - getpeerbyaddr Date: Tue, 28 Oct 2008 19:58:42 -0700 From: Bill Cheng Someone wrote: > For generating log message, if I use getpeername() to get remote host's ip > and > gethostbyaddr() with that ip, it seems gethostbyaddr() can't get an hostname > of local ip. > Is there any other way to get an hostname by the socket file descriptor. When you get a HELLO from your neighbor, you need to remember the hostname and port number inside the HELLO message! Please see: http://merlot.usc.edu/cs551-f08/msgs/bill/309.txt -- Bill Cheng // bill.cheng@usc.edu