With the help of this code, we will be able to fetch the IP(Internet Protocol) address of the device connected to our network.
About the Code:
An IP address (Internet Protocol) is an address in numeric value that is assigned to each device connected to that perticular server. In technial term, it is the identifier that is assigned to each devices connected to that network. Eg: Mobile, Webcam, etc. These addresss are unique for each devices so that each devices can be identified differently.
In this java code , we have used "InetAddress.getLocalHost()" method to get the IP address of the device connected to our network "InetAddress.getHostName()" to get the hostname.
Submitted by Priyonath Mondal (priyonath)
Download packets of source code on Coders Packet