Re: [Socketcan-users] back to back can frames.

Started by Kurt Van Dijck on Jul 5, 2012

open the first message on its own page

Message details and related content
Max,

(please switch using linux-can@vger.kernel.org, as Oliver suggested)

to answer your question, see below

On Thu, Jul 05, 2012 at 11:35:46AM +0000, Max S. wrote:
Hello,

While trying to test a can device I wrote a short program to
continuously send can frames... However after a short while I get a
buffer overflow error. Seems the internal queue is filled and overrun...

How can I send can frames at maximum throughput? simply one after the
other, back to back.

what i have now is something like this:


do{
	//prepare next frame...
}while(write( sfd, frame, sizeof(*arguments.frame) ) == sizeof(*frame));
//print error message...
since the write simply pushes the frame into the queue, it is logical
that the queue would fill up quickly and get overflown?overrun?full.
my core loop would look like this:

	int ret;
	while (1) {
		ret = write(sfd, frame, sizeof(*frame));
		if ((ret < 0) && (errno == ENOBUFS)) {
			usleep(1000);
		} else
			break;
	}
	if (ret < 0)
		/* print error message */
Thanks,
Max S.

_______________________________________________
Socketcan-users mailing list
Socketcan-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/socketcan-users
-- 
Kurt Van Dijck
GRAMMER EiA ELECTRONICS
http://www.eia.be
kurt.van.dijck@eia.be
+32-38708534
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help