libevent cannot read an open socket descriptor -
Recently, I have a small socket server program that is using libevent.
In summary, it works. The incoming connection is properly accepted. You are waiting for your kind comment about this problem. Post-Text "Madprop =" Text "> First of all, take a look at the free Liberty Book by Nick Matthews at Libbevette: Then, To ensure that Event_dispatch () is required to call before is added. Zero Read_function (int FD, short event, zero * arg) {printf (called "callback! \ N"); // read from FD, and send a reply to FD! } Zero accept_thread_function () {int fd = accept (...); Struct event * ev_read = new struct event (); MEMSAT (EVE_FREED, 0, SIIFF (START EVENT)); Event_set (ev_read, fd, EV_READ | EV_PERSIST, read_function, ev_read); Event_add (ev_read, 0); } Int main () {event_init (); Thread A = start 'acceptable_thread_function' as a thread; Event_dispatch (); Thread :: Joining (a); } The problem is that reading work is never called.
Comments
Post a Comment