Boost logo

Boost Users :

Subject: Re: [Boost-users] IOService and socket CAN under Linux
From: Igor R (boost.lists_at_[hidden])
Date: 2010-03-10 13:12:54


> I'm currently working with socket CAN under Linux 2.6.25 and was wondering
> how I can use these with the very handy boost ioservice facility.
> Socket CAN is simply a raw socket created like this: socket(PF_CAN,
> SOCK_RAW, CAN_RAW);
>
> Does someone maybe already have a socket CAN implementation for Boost?
> Is there a way I can add a socket descriptor to an IOService and get a
> callback when
> the socket becomes readable, so that I can read data from the socket?
> The peculiarity about raw CAN sockets is,
> that when they become readable, you don't read the payload
> of the received CAN frame(s) but a struct that represents the received CAN
> frame.
> So it behaves like a datagram socket: You only read full frames.
> What I actually need is a notification mechanism using the IOService facility.

Maybe you can create the socket manually and then assign its
descriptor to udp::socket?
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/basic_datagram_socket/assign.html


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net