1
背景: 我正在拉動防火牆的連接表,以便構建一個頂級通話人/聽衆列表。telnetlib read_until緩衝區大小
在某些情況下,連接表是200,000+個條目。我正在使用telnetlib遠程訪問防火牆並獲取連接表。我使用read_until來捕獲數據。但是,當表格大於40,000個條目時,它會掛起。當我殺了它,我看到以下內容:
Traceback (most recent call last):
File "test2.py", line 152, in ?
main()
File "test2.py", line 120, in main
tmp_text = telnet.read_until(pager_text)
File "/usr/lib/python2.3/telnetlib.py", line 317, in read_until
self.process_rawq()
File "/usr/lib/python2.3/telnetlib.py", line 488, in process_rawq
self.cookedq = self.cookedq + buf[0]
KeyboardInterrupt
我打某種緩衝區?什麼是獲得這些數據的更好方法?
謝謝。
謝謝 - 我會玩read_some,看看它是否有幫助。 Python 2.3.4是我們服務器上的標準,不幸的是我不能升級。 – BDub 2012-03-27 21:03:22