server: auto listener = evconnlistener_new_bind(base, listener_cb, (void *) base, LEV_OPT_REUSEABLE | LEV_OPT_CLOSE_ON_FREE, -1, (struct sockaddr *) &sin, sizeof(sin)); 在 listener_cb中 bufferevent_socket_new bufferevent_setcb bufferevent_enable 在read_cb中 evbuffer_get_length evbuffer_copyout evbuffer_copyout_from evbuffer_drain client: bufferevent_socket_new bufferevent_setcb bufferevent_enable bufferevent_socket_connect timer: event_new(base, -1, EV_PERSIST, timer_cb, NULL) event_add