ping

isReachable in Java doesn't appear to be working quite the way it's supposed to

a 夏天 提交于 2019-12-09 12:58:01
问题 I'm using Clojure, but I can read Java, so this isn't a Clojure specific question. This doesn't even seem to be working from Java. I'm trying to implement a bit of a 'ping' function using isReachable. The code I'm using is this: (.isReachable (java.net.InetAddress/getByName "www.microsoft.com") 5000) Translated to Java by a good friend of mine: public class NetTest { public static void main (String[] args) throws Exception{ String host = "acidrayne.net"; InetAddress a = InetAddress.getByName

快速找到Google可用Hosts的方法

女生的网名这么多〃 提交于 2019-12-09 11:12:16
source:http://www.williamlong.info/archives/3878.html 快速找到Google可用Hosts的方法   Google这些天被封了大量IP,导致现在访问Google服务越来越困难,使用Google搜索的用户也 大量下降 ,对于不想使用付费VPN的用户来说,修改hosts文件来访问Google仍然是一个免费简单的可行方案,今天我就介绍一下我通常用到的快速找到Google可用hosts的方法。    寻找可用IP地址   通常Google的服务器有很多个,一般都会有访问加速功能,就是说对于不同国家会解析出访问速度最快的网址,因此通常中国访问的IP被封后,其他国家访问的IP还能用,因此只要使用一个Ping工具找出这个服务域名对应的多个ip地址,然后在Hosts文件里添加即可。   这个Ping工具实际是一个站长工具,主要用于测试一个网站在不同国家或地区的访问速度,很多网站都提供,一些cdn测试网站也有,百度或Google一下“ping检测”或“ping tools”就能找到很多。    检测可用IP地址   现在,我们找到了一堆IP地址,到底那个是可用的IP地址呢,这里又分为两种情况:   1、HTTP的服务和网址   对于HTTP方式的网址,通常只是封了其80端口,检测方法一般是,“开始”-“运行”-“cmd”,然后输入 ping

How to ping in JavaScript or jQuery?

心不动则不痛 提交于 2019-12-09 09:23:38
问题 I want to create a game-like ping in Javascript, just like the game Counter Strike for example. I'm doing an AJAX call to the server (MySQL) and want to calculate the time that's taken, but I'm either calculating it wrong or have the wrong idea of pinging. Here is the code I have so far: var time_stamp = new Date; $.ajax({ type: "POST", url: "server.php", data: {....}, success: function(output){ ping = new Date - time_stamp; } }); // btw, this code works fine now for ping The problem is that

How to ping a website from an Android activity and get response?

流过昼夜 提交于 2019-12-09 01:02:12
问题 I used isReachable, but it didn't work, and I used ConnectivityManager and getNetworkInfo; actually this works only to check if I am connected to the Internet... But the issue is I want to check if I can access the Internet so I want to ping a website to check if there is a response. 回答1: For the get method: private void executeReq(URL urlObject) throws IOException{ HttpURLConnection conn = null; conn = (HttpURLConnection) urlObject.openConnection(); conn.setReadTimeout(100000); /

centOS7下的静态Ip的配置。

时间秒杀一切 提交于 2019-12-08 22:29:32
centOS7下NAT的静态网卡的配置 最近在cenOS7下搭建大数据,发现centOS7配置静态ip的必要性。这篇博文就来谈谈如何VM虚拟机中配置centOS7的静态ip。如有不足,还望志同道合者纠正和交流,一同进步。 一 为什么要配置在centOS中配置静态ip地址; 这是因为在vm中的centOS中的ip地址在没有重启的情况下发生变化,虚拟机的ip租约过期后,ip就会重新分配,从而造成ip地址的自行变化。为了应用方便和ip地址的固定,就需要设置centOS的静态ip,也就是固态ip地址。 二 在NAT模式下配置centOS中的静态ip 1. 设置vm虚拟机的网路配置,将网卡设置为NAT 模式 设置虚拟机的网卡类型为NAT 模式 查看NAT模式下的虚拟网卡信息。 子网ip:192.168.192.0 也就是centOS的ip可以设置为192.168.192.0~192.168.192.255之间。 子网掩码: 255.255.255.0 网关: 192.168.192.2 这三个在配置时有用。特别是网关一定记住了. 2. 设置centOS的网络适配器为NAT 安装完CentOS之后也可以通过设置来查看网络适配器的类型。一般都是在安装时进行指定。 3. 修改配置文件 ifconfig查看网卡信息: 查看默认网卡信息. 一般网卡信息在 /etc/sysconfig/network

Is there a way to treat Ping-Host as a boolean in PowerShell?

回眸只為那壹抹淺笑 提交于 2019-12-08 18:33:24
I'd like to do something like this: if (Ping-Host server1) { blah } Anyone know of a simple way? Something like this? if ($(Ping-Host server1 -count 1 -timeout 10).received -eq 1) { blah } If you are on PowerShell 2.0 I would recommend using Test-Connection -Quiet. It returns a simple true or false indicating whether or not the host can be reached via ping. BTW one of the benefits of Test-Connection is it's built-in whereas ping-host isn't. 来源: https://stackoverflow.com/questions/1595298/is-there-a-way-to-treat-ping-host-as-a-boolean-in-powershell

Heroku - keeping a dyno alive (May 2013)

我是研究僧i 提交于 2019-12-08 13:55:27
Until now I used for this task the service called Pingdom, but yesterday I tried to sign up for a new application, but there is not the free plan anymore? Anyway, I took a look for an alternative and I found New Relic could do this as well, but there is (in my eyes) one issue - we can set up an URL which we would like to ping, but this URL is pinged periodically each 30 seconds (and each 15 seconds if was detected an error). Cannot this approach "overload" my app? There is also a way to set up the URL for pinging on an another page, for example not for index, but for app.com/ping_url.html But

Pause a batch file until a host is reachable (using ping)?

前提是你 提交于 2019-12-08 13:48:37
I'm looking to add some functionality to a batch file that I've been writing; essentially what happens is I dial up a VPN connection using openvpn and then continue to mount a network drive as well as many other things, what I'm looking to do is: Dial the connection via OpenVPN (which I have working fine) Ping a host on the other side of the VPN and don't continue through the batch file until this host is reachable. Currently I've been using a sleep command of 20 seconds which works, but is not a very clean or intelligent way of going about it; I'd imagine I need some sort of loop to attempt

How to get average reply time from ping command?

点点圈 提交于 2019-12-08 13:22:26
问题 I need to know how to get average reply time from using ping command in the vbs. I found out that I can get all ping output just executing this command but may be I can just get my time data and calculate in variable without using string handling. Set objExec = objShell.Exec("ping -n 2 -w 1000 " & strTarget) strPingResults = LCase(objExec.StdOut.ReadAll) 回答1: I would not recommend shelling out to ping.exe and then parsing the output. Use WMI instead: target = 'somecomputer' n = 2 Set wmi =

Ping a user defined IP-Range with batch

霸气de小男生 提交于 2019-12-08 09:45:31
问题 I'm working on a school project and I wanted to create a batch file that pings a user-defined IP-range and writes the successful pings to a txt file. Now I'm stuck at the FOR loop: @echo off SET /p IPRange=Bitte IP-Range eingeben(xxx.xxx.xxx) : SET /p AnfangsIP=Bitte AnfangsIP des Bereiches eingeben : SET /p EndIP=Bitte EndIP des Bereiches eingeben : FOR /L %IP% (%AnfangsIP%,1,%EndIP%) DO ( ping -n 1 %IP-Range%.%IP% | find "TTL=" >nul if errorlevel 1 ( echo %IP-Range%.%IP% not reachable )