Hostname: Difference between revisions
m
Switch to header template
m (→[[Java]]: Use Java header instead) |
m (Switch to header template) |
||
Line 3:
Find the name of the host on which the routine is running.
==
'''Compiler:''' [[GCC]] 4.0.1
Line 18 ⟶ 17:
}
==
System.Net.Dns.GetHostName();
==
hostname = GETENV('computername')
Line 31 ⟶ 27:
String hostname = java.net.InetAddress.getLocalHost().getHostName();
==
'''Interpreter:''' [[perl]] 5.8.6
use Sys::Hostname;
Line 38 ⟶ 33:
$name = hostname;
==
lvars host = sys_host_name();
==
'''Interpreter:''' [[Python]] 2.5
Line 50 ⟶ 42:
host = socket.gethostname()
==
The basic introspection tool in TCL is the <tt>info</tt> command. It can be used to find out about the version of the current Tcl or Tk, the available commands and libraries, variables, functions, the level of recursive interpreter invocation, and, amongst a myriad other things, the name of the current machine:
set hname [info hostname]
==
2 import gethostname
1024 chars is-array foo
|