{"id":984,"date":"2018-09-17T19:03:11","date_gmt":"2018-09-17T10:03:11","guid":{"rendered":"https:\/\/chat-messenger.com\/?p=984"},"modified":"2018-12-23T01:50:22","modified_gmt":"2018-12-22T16:50:22","slug":"inetaddress-getbyname","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/fr\/blog\/java\/inetadress-getbyname","title":{"rendered":"Java obtient le nom d&#039;h\u00f4te \u00e0 partir de l&#039;adresse IP"},"content":{"rendered":"<h2 class=\"common_title\"><a name=\"0\">Java obtient le nom d&#039;h\u00f4te \u00e0 partir de l&#039;adresse IP<\/a> <strong>InetAddress.getByName()<\/strong><\/h2>\n<p>\nD\u00e9sign\u00e9<strong>adresse IP<\/strong>avoir<strong>nom d&#039;h\u00f4te<\/strong>(<strong>nom de la machine<\/strong>) Ceci est un exemple de programme \u00e0 obtenir.\n<\/p>\n<h2 class=\"common_title\"><a name=\"1\">exemple de programme<\/a><\/h2>\n<pre class=\"sample_src\">\/** * Obtient le nom d&#039;h\u00f4te avec l&#039;adresse IP sp\u00e9cifi\u00e9e. * @param adresse adresse IP * @return nom d&#039;h\u00f4te * *Si une exception inattendue se produit, la cha\u00eene &quot;UnknownHost&quot; est renvoy\u00e9e. *\/ public static String getHostName(String adresse) { try { InetAddress iaddress = InetAddress.getByName(address); return iaddress.getHostName(); } catch (Exception e) { e.printStackTrace(); } return &quot;UnknownHost&quot;; }\r\n<\/pre>\n<p><script type=\"text\/javascript\" src=\"https:\/\/chat-messenger.com\/js\/common.js?dd12sssas2223\" charset=\"UTF-8\"><\/script><br \/>\n<script type=\"text\/javascript\"> writePR(); <\/script><\/p>\n<h2 class=\"common_title\"><a name=\"2\">R\u00e9sultat de l&#039;ex\u00e9cution<\/a><\/h2>\n<p>\u25c6Exemple d&#039;ex\u00e9cution<\/p>\n<pre class=\"sample_src\">public static void main(String[] args) { Nom de la cha\u00eene = getHostName(&quot;66.249.89.99&quot;); System.out.println(&quot;Nom d&#039;h\u00f4te = &#039;&quot;+name+&quot;&#039;&quot;); }\r\n<\/pre>\n<p>\u25c6R\u00e9sultat de sortie<\/p>\n<pre class=\"console\">nom d&#039;h\u00f4te = &#039;jp-in-f99.google.com&#039;\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Java Obtenir le nom d&#039;h\u00f4te \u00e0 partir de l&#039;adresse IP InetAddress.getByName() Adresse IP sp\u00e9cifi\u00e9e [\u2026]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":""},"categories":[19],"tags":[],"_links":{"self":[{"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/posts\/984"}],"collection":[{"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/comments?post=984"}],"version-history":[{"count":4,"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/posts\/984\/revisions"}],"predecessor-version":[{"id":1869,"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/posts\/984\/revisions\/1869"}],"wp:attachment":[{"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/media?parent=984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/categories?post=984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chat-messenger.com\/fr\/wp-json\/wp\/v2\/tags?post=984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}