1 /* RADIUS/RadSec client using libradsec in on-your-own mode. */
3 #include <sys/select.h>
11 fd_set rfds, wfds, xfds;
12 //struct timeval timeout = {1,0}; /* 1 second. */
25 n = select (fd + 1, &rfds, &wfds, &xfds, NULL);
29 fprintf (stderr, "timeout on fd %d after %d seconds\n", fd,
41 /* Ready to read/write/<had error>. */
42 if (FD_ISSET(fd, &rfds))
44 printf ("reading msg\n");
45 radsec_recv_blocking(fd, &msg_in);
46 if (!verify_packet(&msg_in))
48 if (FD_ISSET(fd, &wfds))
50 radsec_send(fd, &msg_out);
51 printf ("msg sent\n");
53 if (FD_ISSET(fd, &xfds))
55 fprintf (stderr, "error on fd %d\n", fd);
63 main (int argc, char *argv[])