Questions tagged [hostname]

A hostname is a human-readable nickname that is assigned to a device connected to a computer network and that is used to identify the device.

A hostname is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication such as the World Wide Web, e-mail or Usenet. Hostnames may be simple names consisting of a single word or phrase, or they may have appended a domain name, which is a name in a Domain Name System (DNS), separated from the host specific label by a period (dot). In the latter form, the hostname is also called a domain name. If the domain name is completely specified including a top-level domain of the Internet, then the hostname is said to be a fully qualified domain name (FQDN).

1162 questions
919
votes
12 answers

How can I use Python to get the system hostname?

I'm writing a chat program for a local network. I would like be able to identify computers and get the user-set computer name with Python.
John
  • 15,418
  • 12
  • 44
  • 65
452
votes
15 answers

How to extract the hostname portion of a URL in JavaScript

Is there a really easy way to start from a full URL: document.location.href = "http://aaa.bbb.ccc.com/asdf/asdf/sadf.aspx?blah" And extract just the host part: aaa.bbb.ccc.com There's gotta be a JavaScript function that does this reliably, but I…
Dustin Getz
  • 21,282
  • 15
  • 82
  • 131
351
votes
12 answers

Recommended way to get hostname in Java

Which of the following is the best and most portable way to get the hostname of the current computer in Java? Runtime.getRuntime().exec("hostname") vs InetAddress.getLocalHost().getHostName()
Mahendra
  • 3,647
  • 2
  • 16
  • 16
221
votes
8 answers

Get hostname of current request in node.js Express

So, I may be missing something simple here, but I can't seem to find a way to get the hostname that a request object I'm sending a response to was requested from. Is it possible to figure out what hostname the user is currently visiting from…
Jesse
  • 10,370
  • 10
  • 62
  • 81
220
votes
2 answers

Can I map a hostname *and* a port with /etc/hosts?

Can I map an IP address like 127.0.0.1 to a domain name and a port? For example, I would like to map 127.0.0.1 to api.example.com:8000
Carson
  • 17,073
  • 19
  • 66
  • 87
130
votes
12 answers

how to find host name from IP with out login to the host

i need to find the host name of a UNIX host whose IP is known with out login to that UNIX host
user75536
  • 1,511
  • 3
  • 11
  • 5
89
votes
7 answers

How to reach docker containers by name instead of IP address?

Is there a way I can reach my docker containers using names instead of ip addresses? I've heard of pipework and I've seen some dns and hostname type options for docker, but I still am unable to piece everything together. Thank you for your time. I'm…
Zhao Li
  • 4,936
  • 8
  • 33
  • 51
85
votes
5 answers

How to get hostname from IP (Linux)?

I'd like to get remote machine/hostname through IP Address. I found lots of answer such as nslookup, host, resloveip, etc.. but I still can't get hostname from my target machine(cent OS, ubuntu etc...) It seems need to register to DNS server? I…
RoyHSIEH
  • 855
  • 1
  • 6
  • 8
83
votes
5 answers

How do I get the local machine name in C#?

How do I get the local machine name?
Yoann. B
  • 11,075
  • 19
  • 69
  • 111
74
votes
3 answers

Node JS return hostname

I'm still learning Node JS and javascript and have an app. I have a configuration file where I need to grab the hostname of the server on Ubuntu 12.04 I tried something like: window.location.hostname But that did not work. Sample code…
nocode
  • 1,238
  • 1
  • 15
  • 21
66
votes
16 answers

How to get page URL or hostname in NextJs Project?

I want to get the page's full URL or site hostname like the image below on Static Site Generator. I will try with window.location.hostname, but it doesn't work. The error: window not defined.
Raju Ahammad
  • 873
  • 2
  • 9
  • 15
65
votes
2 answers

Python lookup hostname from IP with 1 second timeout

How can I look up a hostname given an IP address? Furthermore, how can I specify a timeout in case no such reverse DNS entry exists? Trying to keep things as fast as possible. Or is there a better way? Thank you!
ensnare
  • 40,069
  • 64
  • 158
  • 224
62
votes
3 answers

Difference between SystemInformation.ComputerName, Environment.MachineName, and Net.Dns.GetHostName

From what I have seen, in the MSDN documentation and in other questions here on SO, there are four ways to get the local machine name.…
epotter
  • 7,631
  • 7
  • 63
  • 88
60
votes
6 answers

What is the maximum number of characters for a host-name in Unix?

I am wondering what is the maximum number of characters for a host-name in a Unix system. In addition is there any defined variable that can be used in Unix programming to call that number? (i.e. number of characters allowed for a host-name). I am…
CompilingCyborg
  • 4,760
  • 13
  • 44
  • 61
56
votes
6 answers

How to store the hostname in a variable in a .bat file?

I would like to convert this /bin/sh syntax into a widely compatible Windows batch script: host=`hostname` echo ${host} How to do this so that it'll work on any Windows Vista, Windows XP, and Windows 2000 machine? To clarify: I would then like to…
Edward Q. Bridges
  • 16,712
  • 8
  • 35
  • 42
1
2 3
77 78