1
幾次我見過提到異步ping很好用。Twisted和ICMP(txNetTools)
我寫線程實現(如Ping a site in Python?)
但在〜200個線程,我有美眉
在http://twistedmatrix.com/trac/wiki/ProjectsUsingTwisted頁我覺得 txNetTools - 平,跟蹤路由,ICMP等,在扭曲的實施,併爲那些想建立自己的網絡工具的人提供一個圖書館。
有沒有人用過此圖書館?
我試圖用它ping.py:
Traceback (most recent call last):
File "ping.py", line 23, in <module>
class Pinger(ICMP):
NameError: name 'ICMP' is not defined
如果變化:
class Pinger(**ICMP**):
到
class Pinger():
Traceback (most recent call last):
File "ping.py", line 54, in <module>
reactor.listenICMP(0, Pinger())
File "./txnet/reactor.py", line 21, in listenICMP
p.startListening()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/udp.py", line 102, in startListening
self._connectToProtocol()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/udp.py", line 123, in _connectToProtocol
self.protocol.makeConnection(self)
AttributeError: Pinger instance has no attribute 'makeConnection'
也許我做錯了什麼或不明白?
P.S.扭曲12.0
如果我從主/沙箱運行:ImportError:沒有名爲txnet.icmp的模塊。我複製ping.py到1級達主文件夾 – Echeg 2012-02-23 17:47:52
哦,我有壞的舊代碼 – Echeg 2012-02-23 17:54:57
我拉最新的主人,我仍然得到這個錯誤任何想法? – 2016-07-12 01:18:31