Coding With Libevent Initialize the library: event_init() Setting up read/write callbacks: void sock_read(int fd, short what, void *arg); void sock_write(int fd, short what, void *arg); struct event ev_read, ev_write; fd = socket(AF_UNIX, SOCK_STREAM, 0); event_set(&ev_read, fd, EV_READ, sock_read, &ev_read); event_set(&ev_write, fd, EV_WRITE, sock_write, &ev_write); Scheduling the callbacks: event_add(&ev_read, NULL); event_add(&ev_write, NULL);