SocketCAN / canplayer error: sendto: No buffer space available

Sometimes when running cangen, canplayer or any other can-utils that sends many messages to the can0 socket in linux, you may run into this error:
sendto: No buffer space available

Solution
Without changing anything else, type in the command line:
sudo ifconfig can0 txqueuelen 1000

This will do two things: increase queue length for packet transmission, and generate a default queueing discipline (qdisc) within the can0 socket. There is a great paper here that explains in depth why this works.

3 Likes

Hi,

I have tried your solution but it did not work for me. I have a detailed question on SO with my issue: https://stackoverflow.com/questions/52221802/socketcan-linux-no-buffer-space-available

Any help is highly appreciated!

Hi John,

Sorry for taking so long, but I have been away for a while.

It is possible that you have a totally difference issue.

As I understand it, there is a read-back for CANmessages sent out.
If the read-back does not happen, then the outgoing messages do not get cleared out of the transmit buffer. So, it is quite possible that your hardware is not successfully sending out the messages. This could be due to a hardware issue. In your simulation environment, the most likely issue is with termination of the CANbus. In a car, the CANbus termination is done by the car. As a result, scan tools do not have to deal with termination. Have you designed termination into your hardware? One way to know for sure would be to probe the CANbus with an oscilloscope to ensure the messages are actually going out onto the CANbus and that the signal is clean.