首页 > 代码库 > libevent
libevent
libevent是一个可编写高速可移植非阻塞io应用的开源网络库。它包含很多组件,主要有evutil、event、eventbase、bufferevent、evbuffer、evhttp、evdns、evrpc等。
libevent提供了一个异步dns解析器,以下是简单的实现:
struct event_base = event_init(); evdns_init(); evdns_resolve_ipv4("www.baidu.com", 0, dns_call_back, NULL); event_dispatch(); event_base_free(base); void dns_callback(int result, char type, int count, int ttl, void *address, void *arg) { struct in_addr *addrs = (struct in_addr*)address; char *ip = inet_ntoa(affrs[0]); }
libevent
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。