hostname

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

霸气de小男生 提交于 2019-11-27 13:17:42
问题 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? 回答1: 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 回答2: I

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

荒凉一梦 提交于 2019-11-27 10:26:27
问题 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. 回答1: 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

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

╄→гoц情女王★ 提交于 2019-11-27 01:27:34
问题 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. 回答1: ServletRequest.getServerName(...)

Java SSL: how to disable hostname verification

为君一笑 提交于 2019-11-27 01:07:22
Is there a way for the standard java SSL sockets to disable hostname verfication for ssl connections with a property? The only way I found until now, is to write a hostname verifier which returns true all the time. Weblogic provides this possibility, it is possible to disable the hostname verification with the following property: -Dweblogic.security.SSL.ignoreHostnameVerify Vadzim It should be possible to create custom java agent that overrides default HostnameVerifier : import javax.net.ssl.*; import java.lang.instrument.Instrumentation; public class LenientHostnameVerifierAgent { public

Alias hostname for localhost

天大地大妈咪最大 提交于 2019-11-27 01:04:53
问题 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/ ? 回答1: 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

Get hostname of current request in node.js Express

馋奶兔 提交于 2019-11-27 00:00:45
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 node.js? cjohn If you're talking about an HTTP request, you can find the request host in: request.headers.host But that relies on an incoming request. More at http://nodejs.org/docs/v0.4.12/api/http.html#http.ServerRequest If you're looking for machine/native information, try the process object. You can use the os Module: var os = require("os"); os

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

微笑、不失礼 提交于 2019-11-26 23:56:09
问题 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 回答1: No, that's not possible. The port is not part of the hostname, so it has no meaning in the hosts -file. 回答2: If you really need to do this, use reverse proxy. For example, with nginx as reverse proxy server { listen api.mydomain.com:80; server_name api.mydomain.com; location / { proxy_pass http://127.0.0.1:8000; } } 来源: https://stackoverflow.com/questions

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

僤鯓⒐⒋嵵緔 提交于 2019-11-26 20:27:22
How do I get the local machine name? System.Environment.MachineName dnewcome You should be able to use System.Environment.MachineName for this. It is a property that returns a string containing the netBIOS name of the computer: http://msdn.microsoft.com/en-us/library/system.environment.machinename.aspx Steve From link text Four ways to get your local network/machine name: string name = Environment.MachineName; string name = System.Net.Dns.GetHostName(); string name = System.Windows.Forms.SystemInformation.ComputerName; string name = System.Environment.GetEnvironmentVariable("COMPUTERNAME");

How can I use Python to get the system hostname?

一世执手 提交于 2019-11-26 19:17:27
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. Alex Use socket and its gethostname() functionality. This will get the hostname of the computer where the Python interpreter is running: import socket print(socket.gethostname()) Both of these are pretty portable: import platform platform.node() import socket socket.gethostname() Any solutions using the HOST or HOSTNAME environment variables are not portable. Even if it works on your system when you run it, it may not work when run in special environments

Validate a hostname string

你离开我真会死。 提交于 2019-11-26 19:12:48
问题 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. 回答1: 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