Am 15.05.21 um 20:42 schrieb Kurt Van Dijck: > On Sat, 15 May 2021 18:10:20 +0000, Patrick Menschel wrote: >> Am 15.05.21 um 16:01 schrieb Patrick Menschel: >>> Am 15.05.21 um 14:26 schrieb Kurt Van Dijck: >>>> On Fri, 14 May 2021 12:04:47 +0000, Patrick Menschel wrote: >>>>> Do I need to open one socket per PGN I'm sending? >>>>> e.g. >>>>> >> Guess I have to amend that impression, everything works fine, >> except for broadcast which gives me a PermissionError ?! > > Will you not forget to set the SO_BROADCAST socket option ( see: man 7 socket ) > Thank you both, that was the trick. But why does it throw a PermissionError ? I would expect a ValueError, e.g. -EINVAL because I as a User did the wrong input or rather did not set a socket option. Alternatively -EPROTO. python -i Python 3.9.5 (default, May 13 2021, 13:29:45) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> s = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_J1939) >>> s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, True) >>> s.bind(("mcp0", 0, 0x40000, 0x20)) >>> s.sendto(bytes(range(8)), ("mcp0", 0, 0xFECA, 0xFF)) 8 >>> s.sendto(bytes(range(64)), ("mcp0", 0, 0xFECA, 0xFF)) 64 >>> candump mcp0 mcp0 18FECA20 [8] 00 01 02 03 04 05 06 07 mcp0 18ECFF20 [8] 20 40 00 0A FF CA FE 00 mcp0 18EBFF20 [8] 01 00 01 02 03 04 05 06 mcp0 18EBFF20 [8] 02 07 08 09 0A 0B 0C 0D mcp0 18EBFF20 [8] 03 0E 0F 10 11 12 13 14 mcp0 18EBFF20 [8] 04 15 16 17 18 19 1A 1B mcp0 18EBFF20 [8] 05 1C 1D 1E 1F 20 21 22 mcp0 18EBFF20 [8] 06 23 24 25 26 27 28 29 mcp0 18EBFF20 [8] 07 2A 2B 2C 2D 2E 2F 30 mcp0 18EBFF20 [8] 08 31 32 33 34 35 36 37 mcp0 18EBFF20 [8] 09 38 39 3A 3B 3C 3D 3E mcp0 18EBFF20 [8] 0A 3F FF FF FF FF FF FF Best Regards, Patrick