sebi2k1 / node-can

NodeJS SocketCAN extension
215 stars 72 forks source link

send non-blocking with `non_block_send` set to `false` or `true`. #122

Closed milesstoetzner closed 9 months ago

milesstoetzner commented 10 months ago

First of all, thank you very much for this library.

I am wondering if there is a mistake in the following documentation of send in can.d.ts (also sendFD). It states that non_block_send: false should be used for non-blocking sending. I would assume that one would need to set it to non_block_send: true? Especially considering the fact, that false is already the default set in createRawChannel and createRawChannelWithOptions. Do I understand non_block_send wrong?

/**
* Send a CAN message immediately.
*
* PLEASE NOTE: By default, this function may block if the Tx buffer is not available. Please use
* createRawChannelWithOptions({non_block_send: false}) to get non-blocking sending activated.
*
* @method send
* @param message {Object} JSON object describing the CAN message, keys are id, length, data {Buffer}, ext or rtr
*/
send(message: Message): void;

Greetings

sebi2k1 commented 9 months ago

You are right indeed. Reviewed the code and TRUE enables MSG_DONTWAIT.