freeCodeCamp/curriculum/challenges/chinese-traditional/09-information-security/python-for-penetration-testing/developing-a-port-scanner.md

658 B

id title challengeType videoId bilibiliIds dashedName
5ea9997bbec2e9bc47e94db4 開發一個端口掃描器 11 z_qkqZS7KZ4
aid bvid cid
208077317 BV1Uh411p7HS 409036706
developing-a-port-scanner

--question--

--text--

.connect().connect_ex() 方法的主要區別是什麼?

--answers--

這兩種方法之間沒有區別。


如果有錯誤或沒有找到主機,.connect() 返回一個錯誤代碼,而 .connect_ex() 則引發一個異常。


如果有錯誤或沒有找到主機,.connect() 會引發一個異常,而 .connect_ex() 會返回一個錯誤代碼。

--video-solution--

3