CrossCore XA
Revision: 1.0
Programmers Guide
Date: Jul 1, 10
Syntax
int setsockopt(
int socket,
int level,
int option_name,
const void *option_value,
socklen_t option_len
)
Parameters
socket
Socket file descriptor
level
Protocol level (SOL_CAN_RAW or similar)
option_name Option to set, see definitions in 2.2
option_value Pointer to new value
option_len Specifies
length of option_value
Return value
Returns zero on success. In case of errors, -1 is returned and errno is set appropriately.
Example
This example shows how to disable filters and loopback feature using setsockopt.
int
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0);
if
(opt ==
'B'
) {
const int
loopback = 0;
setsockopt(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK,
&loopback,
sizeof
(loopback));
}
3.3.4.
select
Description
Performs synchronous I/O multiplexing. Select is used to examine several file descriptors at once to
determine if some of them is ready for reading, ready for writing or have an exceptional condition
pending.
Include files
#include <sys/select.h>
Syntax
int select(
int nfds,
fd_set *readfds,
fd_set *writefds,
fd_set *errorfds,
struct timeval *timeout
)
www.crosscontrol.com
15