This looks not good: for (i = 0; i < kevent(kq, NULL, 0, eventlist, EVENT_COUNT, &ts_five_sec); i += 1) { fprintf(stderr, ">> FOUND A KEVENT\n"); line = (char *)calloc(eventlist[i].data + 1, sizeof(char)); recv(sockfd[eventlist[i].ident], line, eventlist[i].data, 0); fprintf(stderr, "MSG = %s\n", line); free(line); }
I've not used kqueue but first (quick) glance at the man page indicates that you look at the return value from kevent() and then iterate over that value (if not -1) and process each eventlist. On Mon, Apr 20, 2009 at 5:11 AM, Artur Grabowski <a...@blahonga.org> wrote: > Taylor Venable <tay...@metasyntax.net> writes: > >> The plain-text version is here: >> B B http://real.metasyntax.net:2357/tmp/kevent.c > > B B B B changelist[i].ident = i; > > Pretty sure this line is your problem. the man page agrees with above statement. Read section about EVFILT_READ filter. --patrick