I use a python library called Bacpypes in order to read bacnet points in network. In my first trial of reading my points with function MultipleReadProperty , there is no problem. I get all values without any problem. But in second poll i get an error about socket like following :
[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.
As seen at first line, i get all values from network with no problem.
To solve problem, i used stop() function of Bacpypes library in a few points of code. Especially just before the code that starts polling. But, it appears that i cant somehow close the socket. Could you please make some suggestions about this issue?
Thanks in advance.