hostname

MySQL error: Can't get hostname from your ip address

送分小仙女□ 提交于 2019-11-28 20:55:36
I use my remote MySQL database during long time. But today I suddenly have found that I cannot connect to the database. I have got an error. "Can't get hostname from your ip address". I haven't changed anything in MySQL settings. What's the problem? Just add below in my.ini or my.cnf . [mysqld] skip-name-resolve Linux: Otherwise, start MySQL server with the following flag: sudo service --skip-name-resolve For more information: http://dev.mysql.com/doc/refman/5.0/en/host-cache.html I've got the same error message on windows. I found my problem is the local server host file. Check the localhost

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

风流意气都作罢 提交于 2019-11-28 17:24:48
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 programming in C. You can usually type: getconf HOST_NAME_MAX In addition, you can generally include limits.h to your application and read the value of the define. While the POSIX standard says it is guaranteed not to exceed 255 bytes, that does not necessarily mean that each implementation will adhere to that. man gethostname on your platform to get

NSNetService works fine, but can't get hostName, resolve causes error

那年仲夏 提交于 2019-11-28 08:48:40
问题 I'm using Bonjour with an NSNetService to publish a server from my iPhone. It all works as expected, I can browse the pages I'm serving etc. However, on the iPhone I want to display the host name (i.e. the URL, like "myDevice.local."), so that one can also enter the address manually in a browser (useful for clients missing a bonjour discovery service). My understanding is that calling the method [myNetService hostName] should give me that address. However, this call always returns nil. I read

How To Resolve Network Host Names From IP Address

一世执手 提交于 2019-11-28 06:53:33
问题 I am working on wifi based chat engine and I was able to retrieve the list of hosts connected to current wifi network by followin this link and now got list of devices with ip addresses but i need host name from the ip address and tried following InetAddress inetAddr; try { inetAddr = InetAddress.getByName(host.hostname); String hostname = inetAddr.getHostName(); String canonicalHostname = inetAddr.getCanonicalHostName(); holder.computerName.setText("Canonical : "+host.hostname); } catch

Alias hostname for localhost

孤者浪人 提交于 2019-11-28 06:50:29
Assuming that a local Python-Script is running a webserver. Is there any way to set an alias, so that http://localwebapp/ equals http://localhost:1234/ ? Edit: Or at least http://localwebapp:1234/ equals http://localhost:1234/ ? When the browser sees http://localwebapp/ it first tries to determine the IP address of localwebapp . If this succeeds, the browser establishes a TCP connection with that host, using a specific port (which is 80 for HTTP, unless some other port is mentioned in the URL). Resolving localwebapp to an IP address does not take port information into account, so pointing http

How can I get a the host name (with port) that a servlet is at

扶醉桌前 提交于 2019-11-28 06:43:48
I thought ServletContext might provide a method. Does the getAttribute() method of ServletContext provide any help i.e. is there an attribute name (maybe "host", "port") that will be of help. The reason for this is I want my application to run wherever it is deployed, and at one point I have to allow a user to click a link that points to a location on the file server. Hence I need to reference by the host and port and cannot use an internal reference. Everyone ServletRequest.getServerName(...) ServletRequest.getServerPort(...) The ServletRequest object that has been passed to your doGet, or

How to get local host name in C# on a Windows 10 universal app

别说谁变了你拦得住时间么 提交于 2019-11-28 00:23:52
问题 string machineName = System.Environment.MachineName; This code doesn't work for me, error code 'Environment' does not contain a definition for 'MachineName' I'm using Visual Studio 2015 and Universal App with C# Please also list the namespace I need to use when you post an answer. 回答1: You need to use NetworkInformation.GetHostNames. var hostNames = Windows.Networking.Connectivity.NetworkInformation.GetHostNames(); But note that this method will return multiple HostName s. In my case, it

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

寵の児 提交于 2019-11-27 19:13:59
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. Environment.MachineName; System.Net.Dns.GetHostName(); System.Windows.Forms.SystemInformation.ComputerName; System.Environment.GetEnvironmentVariable("COMPUTERNAME"); Is there a differnece in what they methods will return or will they all return the exact same thing all of the time? Note: I first saw the list in this post: How do I get the local machine Name? EventHorizon Environment.MachineName and System.Windows.Forms.SystemInformation.ComputerName are

Validate a hostname string

最后都变了- 提交于 2019-11-27 17:53:06
Following up to Regular expression to match hostname or IP Address? and using Restrictions on valid host names as a reference, what is the most readable, concise way to match/validate a hostname/fqdn (fully qualified domain name) in Python? I've answered with my attempt below, improvements welcome. Tim Pietzcker import re def is_valid_hostname(hostname): if len(hostname) > 255: return False if hostname[-1] == ".": hostname = hostname[:-1] # strip exactly one dot from the right, if present allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE) return all(allowed.match(x) for x in

python: check if a hostname is resolved

浪子不回头ぞ 提交于 2019-11-27 15:57:23
问题 How can I have a function in python that returns 1 if the a hostname resolves and 0 if a hostname does not. I couldn't find anything useful, any thoughts? Thanks, 回答1: You can use socket.gethostbyname() for this: >>> import socket >>> socket.gethostbyname('google.com') '74.125.224.198' >>> socket.gethostbyname('foo') # no host 'foo' exists on the network Traceback (most recent call last): File "<stdin>", line 1, in <module> socket.gaierror: [Errno 8] nodename nor servname provided, or not