我该如何检查互联网连接OSX [英] How do I check for internet connection OSX

查看:147
本文介绍了我该如何检查互联网连接OSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iMac电脑的Wi-Fi是有点不稳定。有时,它说,它的连接状态,并有完整的信号,但是网页无法在Safari或Chrome加载。我不得不打开WiFi /关闭进行修复。

奇怪的是,当我平安google.com上的终端,我有0%的丢包。

  PING www.google.com(68.104.213.123):
icmp_seq = 0 TTL = 52时间为21.530毫秒:56数据字节68.104.213.123 64字节--- www.google.com ping统计---
1包转发,收到1报文,0.0%的丢包率
往返最小/平均/最大/ STDDEV = 21.530 / 21.530 / 21.530 / 0.000毫秒

我做了这个苹果脚本来尝试解决这个问题,但似乎我需要检查实际的互联网连接,而不是仅仅侦测另一种方法。我能做什么?

 重复
    尝试
        做shell脚本的ping -t -o 2 www.google.com
    出错
        说无法连接
        做shell脚本networksetup -setairportpower EN1关
        做shell脚本休眠5
        做shell脚本networksetup -setairportpower EN1的
    年底试
    推迟60
重复结束


解决方案

卷曲www.apple.com 将从终端接入互联网。

My iMac wi-fi is a bit unstable. Sometimes it says it's connected and has full signal, but webpages won't load in Safari or Chrome. I have to turn wifi off/on to fix it.

The weird thing is when I ping google.com on Terminal, I have 0% packet loss.

PING www.google.com (68.104.213.123):
56 data bytes 64 bytes from 68.104.213.123: icmp_seq=0 ttl=52 time=21.530 ms

--- www.google.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 21.530/21.530/21.530/0.000 ms

I made this Apple Script to try to fix this, but it seems like I need another method for checking actual internet connection instead of just pinging. What could I do?

repeat
    try
        do shell script "ping -o -t 2 www.google.com"
    on error
        say "Couldn't connect"
        do shell script "networksetup -setairportpower en1 off"
        do shell script "sleep 5"
        do shell script "networksetup -setairportpower en1 on"
    end try
    delay 60
end repeat

解决方案

curl www.apple.com will access the internet from terminal

这篇关于我该如何检查互联网连接OSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆