Oups, meant to send my reply to the list...

On Mon, Feb 2, 2015 at 10:01 AM, Yann Ylavic <[email protected]> wrote:
> What does nslookup (or alike) output for these IPs ?
>
> On Mon, Feb 2, 2015 at 9:41 AM, GHui <[email protected]> wrote:
>>
>> There is some error, so I resend again.
>>
>> [root@myHOST ~]# ./hostname 172.18.4.49
>>>><<IP: 172.18.4.49
>>>><<HOST: (null)
>> [root@myHOST ~]# ./hostname 172.18.4.48
>>>><<IP: 172.18.4.48
>>>><<HOST: localhost
>>
>> Note: The 172.18.4.49 and 172.18.4.48 are not in /etc/hosts.
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "Joshua Marantz";<[email protected]>;
>> Send time: Sunday, Feb 1, 2015 10:56 PM
>> To: "GHui"<[email protected]>;
>> Cc: "Jeff Trawick"<[email protected]>; "dev"<[email protected]>;
>> Subject:  Re: apr_getnameinfo get localhost
>>
>> I am not an expert in this apr routine, but I think it might help if you
>> gave the command-line argument you used when testing your program.
>>
>> -Josh
>>
>> On Sun, Feb 1, 2015 at 7:17 AM, GHui <[email protected]> wrote:
>>>
>>>
>>> Is there any good news? Any help will be appreciated.
>>>
>>> --GHui
>>>
>>>
>>> ------------------ Original ------------------
>>> From:  "ugiwgh";<[email protected]>;
>>> Send time: Thursday, Jan 29, 2015 9:03 AM
>>> To: "Jeff Trawick"<[email protected]>;
>>> Cc: "dev"<[email protected]>;
>>> Subject:  Re: apr_getnameinfo get localhost
>>>
>>>
>>> From:  "Jeff Trawick";<[email protected]>; Send time: Wednesday, Jan 28,
>>> 2015 10:26 PM
>>> On Wed, Jan 28, 2015 at 2:26 AM, GHui <[email protected]> wrote:
>>>>
>>>> I used the function  apr_getnameinfo to get remote hostname. But it
>>>> return "localhost".
>>>> I don't know why this happend.
>>>> Any help will be appreciated.
>>>> --GHui
>>>
>>>
>>> Please show code, such as where the second parameter to apr_getnameinfo()
>>> came from.
>>> --
>>> Born in Roswell... married an alien...
>>> http://emptyhammock.com/
>>>
>>>
>>> The code is following.
>>> ---------------------------------------------
>>> int main(int argc,char **argv)
>>> {
>>>   if(2!=argc)
>>>   {
>>>     printf("Usage: %s <ip>\n",argv[0]);
>>>     return 1;
>>>   }
>>>   char *remoteip=argv[1];
>>>   printf(">><<IP: %s\n",remoteip);
>>>   apr_initialize();
>>>   apr_pool_t *mp;
>>>   apr_pool_create(&mp,NULL);
>>>   apr_sockaddr_t *sa;
>>>   apr_sockaddr_info_get(&sa,remoteip,APR_INET,10089,0,mp);
>>>   char *hostname=NULL;
>>>   apr_getnameinfo(&hostname,sa,0);
>>>   printf(">><<HOST: %s\n",hostname);
>>>
>>>   apr_terminate();
>>>   return 0;
>>> }
>>> --------------------------------------------
>>
>>

Reply via email to