尝试通过 Bacpypes 从网络再次读取时出现 Errno 10048
Errno 10048 when trying to read again from network through Bacpypes
我使用名为 Bacpypes 的 python 库来读取网络中的 bacnet 点。在我第一次尝试使用函数 MultipleReadProperty 阅读我的观点时,没有问题。我毫无问题地获得了所有价值。但是在第二次轮询中,我收到如下有关套接字的错误:
[0.0, 1149064.0, 1941115.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 13525024.0, 448152.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[31/Jan/2015:11:39:33] HTTP Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cherrypy\_cprequest.py", line 670, in respond
response.body = self.handler()
File "C:\Python27\lib\site-packages\cherrypy\lib\encoding.py", line 217, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "C:\Python27\lib\site-packages\cherrypy\_cpdispatch.py", line 61, in __call__
return self.callable(*self.args, **self.kwargs)
File "C:\Users\Sansal\Desktop\Projeler\sayac_okuma8\main2.py", line 231, in sayac_oku
readings_from_counters=ReadCounters(counters_list)
File "C:\Users\Sansal\Desktop\Projeler\sayac_okuma8\main2.py", line 153, in ReadCounters
this_application = ReadPointListApplication(points_list, this_device, args.ini.address)
File "C:\Users\Sansal\Desktop\Projeler\sayac_okuma8\main2.py", line 43, in __init__
BIPSimpleApplication.__init__(self, *args)
File "C:\Python27\lib\site-packages\bacpypes-0.10.6-py2.7.egg\bacpypes\app.py", line 555, in __init__
self.mux = UDPMultiplexer(self.localAddress)
File "C:\Python27\lib\site-packages\bacpypes-0.10.6-py2.7.egg\bacpypes\bvllservice.py", line 85, in __init__
self.directPort = udp.UDPDirector(self.addrTuple)
File "C:\Python27\lib\site-packages\bacpypes-0.10.6-py2.7.egg\bacpypes\udp.py", line 144, in __init__
self.bind(address)
File "C:\Python27\lib\asyncore.py", line 342, in bind
return self.socket.bind(addr)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
如第一行所示,我可以毫无问题地从网络获取所有值。
为了解决问题,我在几个代码点中使用了 Bacpypes 库的 stop() 函数。特别是在开始轮询的代码之前。但是,看来我无法以某种方式关闭套接字。您能否就此问题提出一些建议?
提前致谢。
Bacpypes 最近已经更新到 0.15 版本,并且在文档方面做了很多努力。有很多新功能,并且针对典型的事情(例如 whois、IAm)简化了代码。
建议你看看http://bacpypes.readthedocs.io/en/latest/
这里:https://github.com/JoelBender/bacpypes/blob/master/samples/MultipleReadProperty.py
我还可以推荐 BAC0 (http://bac0.readthedocs.io/en/latest/),它建立在 bacpypes 之上并提供 out-of-the box 功能来与 BACnet 设备通信。 (免责声明:BAC0 是我的项目,我是 bacpypes 的贡献者)
我使用名为 Bacpypes 的 python 库来读取网络中的 bacnet 点。在我第一次尝试使用函数 MultipleReadProperty 阅读我的观点时,没有问题。我毫无问题地获得了所有价值。但是在第二次轮询中,我收到如下有关套接字的错误:
[0.0, 1149064.0, 1941115.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 13525024.0, 448152.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[31/Jan/2015:11:39:33] HTTP Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cherrypy\_cprequest.py", line 670, in respond
response.body = self.handler()
File "C:\Python27\lib\site-packages\cherrypy\lib\encoding.py", line 217, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "C:\Python27\lib\site-packages\cherrypy\_cpdispatch.py", line 61, in __call__
return self.callable(*self.args, **self.kwargs)
File "C:\Users\Sansal\Desktop\Projeler\sayac_okuma8\main2.py", line 231, in sayac_oku
readings_from_counters=ReadCounters(counters_list)
File "C:\Users\Sansal\Desktop\Projeler\sayac_okuma8\main2.py", line 153, in ReadCounters
this_application = ReadPointListApplication(points_list, this_device, args.ini.address)
File "C:\Users\Sansal\Desktop\Projeler\sayac_okuma8\main2.py", line 43, in __init__
BIPSimpleApplication.__init__(self, *args)
File "C:\Python27\lib\site-packages\bacpypes-0.10.6-py2.7.egg\bacpypes\app.py", line 555, in __init__
self.mux = UDPMultiplexer(self.localAddress)
File "C:\Python27\lib\site-packages\bacpypes-0.10.6-py2.7.egg\bacpypes\bvllservice.py", line 85, in __init__
self.directPort = udp.UDPDirector(self.addrTuple)
File "C:\Python27\lib\site-packages\bacpypes-0.10.6-py2.7.egg\bacpypes\udp.py", line 144, in __init__
self.bind(address)
File "C:\Python27\lib\asyncore.py", line 342, in bind
return self.socket.bind(addr)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
如第一行所示,我可以毫无问题地从网络获取所有值。
为了解决问题,我在几个代码点中使用了 Bacpypes 库的 stop() 函数。特别是在开始轮询的代码之前。但是,看来我无法以某种方式关闭套接字。您能否就此问题提出一些建议?
提前致谢。
Bacpypes 最近已经更新到 0.15 版本,并且在文档方面做了很多努力。有很多新功能,并且针对典型的事情(例如 whois、IAm)简化了代码。
建议你看看http://bacpypes.readthedocs.io/en/latest/
这里:https://github.com/JoelBender/bacpypes/blob/master/samples/MultipleReadProperty.py
我还可以推荐 BAC0 (http://bac0.readthedocs.io/en/latest/),它建立在 bacpypes 之上并提供 out-of-the box 功能来与 BACnet 设备通信。 (免责声明:BAC0 是我的项目,我是 bacpypes 的贡献者)