BAC0 programs using Loopback device (lo) #370
raghavan97
started this conversation in
Ideas
Replies: 1 comment
-
Easiest fix for that is to create a second IP address for the network interface. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We have a BACnet Gateway product that works on the 47808 port (configurable). It works on the eth0 device and there is no other eth device for me to play with.
I wanted to do the regular stuff that the BACnet client does like discover, read property, Write property etc. But I could not use BAC0 for that on the same device, it always came back with "a Program is already bound to this port". This is because our BACnet gateway was indeed using the port. I could use BAC0 on another equipment in the same LAN and it was working just fine.
I was wondering about using the Loopback device (lo) , since it is just there waiting to be used.I tried running BAC0 on the Loopback device (by giving 127.0.0.1) and it always came back with a "Program is already bound to this port".
After a little bit of investigation, I found that the following changes would allow us to run the BAC0 programs on the loopback device.
(1) A change to
validate_ip_address()
to set the socket option to reuse the address before bind()s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
(2) The UDPMultiplexer in bacpypes does not allow us to pass the parameters to the UDPDirector. The UDPDirector has a named parameter reuse=False. if we can pass the
reuse=True
there, then BACpypes would also allow us to go ahead.I derived MyUDPMultiplexer() from the UDPMultiplexer and passed the reuse=True to UDPDirector()
With these two changes, I was able to run my BAC0 programs using loopback device (lo) on my physical equipment. I did not need a virtual interface or BBMD support.
Thought this might help other people who need some tool to verify BACnet interface on the same physical equipment.
I would be happy to raise a change request, if you think it will help others in the community.
Beta Was this translation helpful? Give feedback.
All reactions