You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are 2 issues with UdpMulticastBus and MacOS.
First one is once one process opened the socket, another process could not. This made having one process send messages and another receive them on the same computer problematic. Doing this:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) fixed that problem.
The second one was reading timestamps with SIOCGSTAMP didn't work - MacOS doesn't support that ioctl. I don't know how to fix that one. I just removed it and replaced the timestamp with a sequence number instead.
To Reproduce
Try to set up a UdpMulticastBus interface on 2 processes on MacOS (v14.4)
Expected behavior
Able to set up multiple UdpMulticastBus interfaces on multiple processes on same computer
Additional context
OS and version: MacOS 14.4
Python version: 3.12.2
python-can version: main
python-can interface/s (if applicable): UdpMulticastBus
I have code to address these issues - I can submit a pull request if desired.
Traceback and logs
import can
def receive_messages():
# Configure the bus with the multicast group and port
bus = can.Bus(interface='udp_multicast', channel='239.0.0.1', port=10000, receive_own_messages=False)
print(f"Listening for messages...")
while True:
message = bus.recv() # Block until a message is received
if message:
print(f"Received: {message}")
if name == 'main':
receive_messages()
The text was updated successfully, but these errors were encountered:
Describe the bug
There are 2 issues with UdpMulticastBus and MacOS.
First one is once one process opened the socket, another process could not. This made having one process send messages and another receive them on the same computer problematic. Doing this:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) fixed that problem.
The second one was reading timestamps with SIOCGSTAMP didn't work - MacOS doesn't support that ioctl. I don't know how to fix that one. I just removed it and replaced the timestamp with a sequence number instead.
To Reproduce
Try to set up a UdpMulticastBus interface on 2 processes on MacOS (v14.4)
Expected behavior
Able to set up multiple UdpMulticastBus interfaces on multiple processes on same computer
Additional context
OS and version: MacOS 14.4
Python version: 3.12.2
python-can version: main
python-can interface/s (if applicable): UdpMulticastBus
I have code to address these issues - I can submit a pull request if desired.
Traceback and logs
import can
def receive_messages():
# Configure the bus with the multicast group and port
bus = can.Bus(interface='udp_multicast', channel='239.0.0.1', port=10000, receive_own_messages=False)
if name == 'main':
receive_messages()
The text was updated successfully, but these errors were encountered: