ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?

user-image
تم إضافة السؤال من قبل Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
تاريخ النشر: 2014/04/16
مستخدم محذوف‎
من قبل مستخدم محذوف‎

Is that public ip address or private LAN address.

 

considering as public IP:

 

the domain you mentioned is "java.sun.com" ie an example. where "java" is subdomain.

=> go to the cpanel of the domain and point the ip192.18.97.39 to "java", ie

create cname =java, TTL=14400 , IP=192.18.97.39

 

now  for reverse lookup or fqdn, you need to ask your ISP for PTR.

 

considering as Private IP:

set the name of the computer as "java",

put its ip address as192.18.97.39

register the computer in the domain server which is named as "sun.com" within your LAN network

 

 

Mufeed Farhan
من قبل Mufeed Farhan , HR Applications Manager , SBM

You can use the below code :

 

package com.devdaily.javasamples;import java.net.InetAddress;import java.net.UnknownHostException;/** * Shows how to convert an IP address into a hostname. * Created by Alvin Alexander, http://devdaily.com. */public class InetAddressExample{  public static void main(String[] args)   throws UnknownHostException  {    String hostname = InetAddress.getByName("192.18.97.39").getHostName();    System.out.println("hostname = " + hostname);  }}

 

Copied from : http://alvinalexander.com/blog/post/java/java-faq-convert-ip-address-to-hostname

 

المزيد من الأسئلة المماثلة