The Artima Developer Community
Sponsored Link

Java Buzz Forum
How to Find IP address of Localhost, Server or Your Machine

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
How to Find IP address of Localhost, Server or Your Machine Posted: Feb 27, 2014 6:55 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: How to Find IP address of Localhost, Server or Your Machine
Feed Title: Java67
Feed URL: http://www.java67.com/feeds/posts/default?alt=rss
Feed Description: Java and technology tutorials, tips, questions for all programmers.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67

Advertisement
In today's Java programming tutorial, we will learn some networking basics by exploring java.net package. One of the simple Java network programming exercise, yet very useful, is to write a program to find IP address of local host in Java. Some time this question also asked as find IP address of Server on which your Java program is running, or find IP address of your machine using Java etc. In short, they all refer to localhost. For those who are entirely new in networking space, there are two things to identify a machine in a network, which could be LAN, WAN or Internet. First thing is DNS name and second thing is IP address. In Local Area Network, DNS is more generally replaced by hostname, which could be as simple as ReportingServer to ReportingServer.com or something else. Both this hostname and IP address are related to each other, which means given hostname, your computer can find IP address and vice-versa. The file they use for hostname to IP address resolution is /etc/host in both Windows 8 and Linux. Java provides API to get this IP address by providing hostname. Since localhost is used to refer the machine on which program is running, you can provide that to get IP address or your Server, or your desktop in Java. By the way, if you are doing support and need it for real purpose there are more easy windows and Linux commands to convert hostname to IP address and vice-versa, you can check them here.
Read more ยป

Read: How to Find IP address of Localhost, Server or Your Machine

Topic: Spring RESTBucks: Hypermedia-driven REST Webservices Previous Topic   Next Topic Topic: Design Patterns: Pattern or Anti-Pattern, that is the question

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use