Python 3.5 socket OSError: [Errno 101] Network is unreachable


/********************************************************************************
 *       Python 3.5 socket OSError: [Errno 101] Network is unreachable
 * 說明:
 *     在網絡狀態一切正常的時候沒有出現這個問題,當出現比較長時間的網絡連接中斷
 * 的情況下,會出現這個現象,try...except...解決。
 *
 *                                              2017-3-1 深圳 南山平山村 曾劍鋒
 ********************************************************************************/

一、錯誤現象:
    Traceback (most recent call last):
      File "localDetect.py", line 22, in <module>
        socketClient.sendto(mac.encode('utf-8'), address)  
    OSError: [Errno 101] Network is unreachable

    [1]+  Done(1)                    python localDetect.py

二、錯誤原因:
    網絡狀態不好,socket的sendto等待超時。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM