Function drivers::socketcan::bind_can_socket
Defined in File socket_can_common.hpp
Function Documentation
-
int32_t drivers::socketcan::bind_can_socket(const std::string &interface, bool enable_fd, bool enable_loopback = false)
Bind a non-blocking CAN_RAW socket to the given interface
- Parameters:
interface – [in] The name of the interface to bind, must be smaller than IFNAMSIZ
enable_fd – [in] Whether this socket uses CAN FD or not
enable_loopback – [in] Whether this socket will receive sent messages from other processes connected to the same socket on the same system
- Throws:
std::runtime_error – If one of socket(), fnctl(), ioctl(), bind() failed
std::domain_error – If the provided interface name is too long
- Returns:
The file descriptor bound to the given interface