Results 1 to 1 of 1
Thread: Getting name/ip of a machine
-
Getting name/ip of a machine
The example presented below gets and prints name and ip of the machine.
Java Code:public class NetInfo { public static void main(String[] args) { new NetInfo().say(); } public void say() { try { java.net.InetAddress i = java.net.InetAddress.getLocalHost(); System.out.println(i); // name and IP address System.out.println(i.getHostName()); // name System.out.println(i.getHostAddress()); // IP address only } catch(Exception e){e.printStackTrace();} } }
Similar Threads
-
How to get URL from network machine
By Mir in forum NetworkingReplies: 1Last Post: 04-02-2008, 12:08 AM -
Getting address of Local Machine
By Java Tip in forum Java TipReplies: 0Last Post: 11-24-2007, 07:38 PM -
Turing machine Help please!!
By bladeb2k in forum Java AppletsReplies: 1Last Post: 08-15-2007, 09:47 PM -
Too many virtual Machine
By davantmay in forum Java AppletsReplies: 1Last Post: 07-06-2007, 10:53 PM -
Virtual Machine To Pda
By Heather in forum Advanced JavaReplies: 2Last Post: 06-30-2007, 03:11 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks