Is it possible to send a "one-shot" CAN message using SocketCAN? This is basically a message that does not expect an acknowledgement back from the receiver. The protocol allows this ACK bit not to be set.
I'm not sure what you mean by "one-shot", but I send single CAN frames all the time using the cansend
utility from can-utils, like this:
$ cansend can0 135#02080426A10D112A
I've also written C programs that do the same using an AF_CAN
socket. (You can basically crib from cansend.c
to figure out how.)
Regarding retransmission of messages, this doesn't happen with cansend
:
$ timeout 20s tcpdump -i can0 -w out.pcap &
[1] 16509
tcpdump: listening on can0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), capture size 262144 bytes
$ cansend can0 135#02080426A10D112A
$ 1 packet captured
0 packets received by filter
0 packets dropped by kernel
[1] + 16509 exit 124 timeout 20s tcpdump -i can0 -w out.pcap
In the sequence above, there are no consumers online, so nobody ACKs the message, but I still only capture a single packet on can0
. It seems safe to conclude that the SocketCAN stack isn't 'automagically' trying to re-send the message in the background after cansend
exits.