跳至主要内容

libevent2的一些api

 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


评论

此博客中的热门博文

ubuntu 添加root登录

Login to your server as root. As the root user, edit the sshd_config file found in  /etc/ssh/sshd_config : vim /etc/ssh/sshd_config ( For details on working with Vim check out our article here !) Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there. PermitRootLogin yes Save and exit the file. Restart the SSH server: systemctl restart sshd or service sshd restart