国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

能否使用JavaScript來ping一個IP?
高洛峰
高洛峰 2017-04-10 15:11:08
0
3
776

目標IP沒有裝任何web或者http應(yīng)用
能否用JavaScript來實現(xiàn)ping這樣的一個IP,功能類似與console下的ping ip

高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項目經(jīng)理、高級軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(3)
Peter_Zhu

如評論所說, 瀏覽器無法構(gòu)建自定義包, 所以不可能ping, js僅支持http.

function Pinger_ping(ip, callback) {

  if(!this.inUse) {

    this.inUse = true;
    this.callback = callback
    this.ip = ip;

    var _that = this;

    this.img = new Image();

    this.img.onload = function() {_that.good();};
    this.img.onerror = function() {_that.good();};

    this.start = new Date().getTime();
    this.img.src = "http://" + ip;
    this.timer = setTimeout(function() { _that.bad();}, 1500);

  }
}

https://github.com/jdfreder/pingjs
轉(zhuǎn)自:
http://stackoverflow.com/questions/4282151/is-it-possible-to-ping-a-se...

大家講道理

1、自己實現(xiàn):寫個后臺API,然后前臺發(fā)送必要的參數(shù),再展示ping結(jié)果。
2、抓包:已有很多網(wǎng)站有此功能,直接爬蟲抓過來使用。(直接通過通過別人的網(wǎng)站功能來Ping)
3、使用第三方Ping的API,前段調(diào)用這個API實現(xiàn)ping.

小葫蘆

不僅僅是沒有組包功能,主要是沒辦法操作網(wǎng)絡(luò)io設(shè)備

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template