越来越流行的ss命令(在RHEL上为/ usr / sbin / ss)代替了netstat。
我试图解析Python中的输出,并且看到一些文档中未解释的奇怪数据。
$ ss -an | head
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 0 :::14144 :::*
LISTEN 0 0 127.0.0.1:32000 *:*
LISTEN 0 0 :::3233 :::*
LISTEN 0 0 *:5634 *:*
LISTEN 0 0 :::5634 :::*
Run Code Online (Sandbox Code Playgroud)
因此,很明显本地地址是127.0.0.1:32000时意味着什么,显然是在端口32000上的回送接口上侦听。但是,三个冒号:::是什么意思?
真的,我可以认为这是两个额外的冒号,因为格式为host:port,那么两个冒号的主机是什么意思?
我应该提到我正在RHEL / CENTOS机器上运行它:
Linux boxname 2.6.18-348.3.1.el5 #1 SMP somedate x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
我在任何联机手册页或其他讨论中都没有对此进行解释。
我正在使用 Python 和 MongoDB 来尝试紧密保存浮点数组。
我可以正确创建和存储*
但我无法以可用的格式检索数据。
>>> import random, array, pymongo
>>> from bson.binary import Binary as BsonBinary
>>> con = pymongo.Connection('localhost', 27017)
>>> mm = con['testDatabase']
>>> vals = [random.random() *100 for x in range(1, 5)]
>>> vals
[2.9962593, 64.5582810776, 32.3781311717, 82.0606953423]
>>> varray = array.array('f', vals)
>>> varray
array('f', [2.9962593, 64.5582810776, 32.3781311717, 82.0606953423])
>>> vstring = varray.tostring()
>>> vstring
'\xb7\xc2?@\xd7\x1d\x81B5\x83\x01B\x13\x1f\xa4B'
>>> vbson = BsonBinary(vstring, 5)
>>> vbson
Binary('\xb7\xc2?@\xd7\x1d\x81B5\x83\x01B\x13\x1f\xa4B', 5)
>>> doc1 = { 'something': 1 …
Run Code Online (Sandbox Code Playgroud)